[PHP-DB] International Addresses and Telephones

2003-12-04 Thread Rankin, Randy
I have a form which captures US addresses ( address, city, state ) and
telephone numbers ( 10 digit ) and am writing this data to a MySQL table. I
need to expand this to capture non-US info, so I was hoping for some
guidance on forms and table structures. I have googled this to death and
still haven't come up with anything. 

 


[PHP-DB] PHP, MySQL and Flash

2003-07-09 Thread Rankin, Randy
Does anyone know of any articles on integrating PHP, MySQL and Flash to
perform a drag and drop routine for updating a db?

Specifically, I have a client who is _INSISTING_ that I integrate a drag and
drop feature into his railcar storage application. He wants to be able to
view two railcar storage tracks, Track A and Track B, then drag and drop
cars from Track A to Track B ( or Track B to Track A ). Once he positions (
orders ) all the cars properly on each track, I need to update a MySQL db to
reflect the changes. 

I have already developed the above feature so that he can do this
'textually', but he is _determined_ that he must have the graphic 'drag and
drop' feature. 

There may be another method ( Javascript ? ) to accomplish the same effect.
I am certainly open to any advice and/or opinions. Any pointers would be
_greatly_ appreciated.

Thanks, 

Randy Rankin



RE: [PHP-DB] Datetime help in an INSERT...

2003-06-05 Thread Rankin, Randy
If you are using MySql with the date field is of type timestamp, you should
have to insert anything using the query. It will update automatically when
the record is inserted and/or updated.

ie; $denylog = INSERT INTO deny (account, td ) VALUES ($tmp, $td );

Randy

-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:47 PM
To: '[EMAIL PROTECTED]'
Cc: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Datetime help in an INSERT...


The error I am receiving is:

You have an error in your SQL syntax near ' NOW())' at line 1

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:45 PM
To: NIPP, SCOTT V (SBCSI)
Subject: Re: [PHP-DB] Datetime help in an INSERT...


what kind of error are you getting?

   I am stumbling across something that I thought I have done before,
 and I am not having any luck finding an example of this.  Basically, I am
 wanting to timestamp the date and time into new entries in a simple
database
 table.  The following section is the actual code for this, and I cannot
 figure out how to get the date/time stamp to populate into the database.
 Thanks in advance for the help.  I suspect this is a very simple fix.
 
 $denylog = INSERT INTO deny (account, td, date) VALUES ($tmp, $td,
NOW());
 $denylog_result = mysql_query($denylog, $Prod) or die(mysql_error());
 
 Scott Nipp
 Phone:  (214) 858-1289
 E-mail:  [EMAIL PROTECTED]
 Web:  http:\\ldsa.sbcld.sbc.com
 
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Datetime help in an INSERT...

2003-06-05 Thread Rankin, Randy
Correction ( I typed this in a hurry ) ...

If you are using MySql and the date field is of type timestamp, you should
_not_
have to insert anything using the query. It will update automatically when
the record is inserted and/or updated.

ie; $denylog = INSERT INTO deny (account, td ) VALUES ($tmp, $td );

Randy

-Original Message-
From: Rankin, Randy [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:56 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Datetime help in an INSERT...


If you are using MySql with the date field is of type timestamp, you should
have to insert anything using the query. It will update automatically when
the record is inserted and/or updated.

ie; $denylog = INSERT INTO deny (account, td ) VALUES ($tmp, $td );

Randy

-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:47 PM
To: '[EMAIL PROTECTED]'
Cc: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Datetime help in an INSERT...


The error I am receiving is:

You have an error in your SQL syntax near ' NOW())' at line 1

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:45 PM
To: NIPP, SCOTT V (SBCSI)
Subject: Re: [PHP-DB] Datetime help in an INSERT...


what kind of error are you getting?

   I am stumbling across something that I thought I have done before,
 and I am not having any luck finding an example of this.  Basically, I am
 wanting to timestamp the date and time into new entries in a simple
database
 table.  The following section is the actual code for this, and I cannot
 figure out how to get the date/time stamp to populate into the database.
 Thanks in advance for the help.  I suspect this is a very simple fix.
 
 $denylog = INSERT INTO deny (account, td, date) VALUES ($tmp, $td,
NOW());
 $denylog_result = mysql_query($denylog, $Prod) or die(mysql_error());
 
 Scott Nipp
 Phone:  (214) 858-1289
 E-mail:  [EMAIL PROTECTED]
 Web:  http:\\ldsa.sbcld.sbc.com
 
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Help with MySQL Logic

2003-03-04 Thread Rankin, Randy
Thanks to everyone for your help. I was able to work out the logic last
night based on your fine suggestions and all is well!

Thanks again.

Randy

  -Original Message-
 From: 1LT John W. Holmes [EMAIL PROTECTED]  
 Sent: Monday, March 03, 2003 10:30 AM
 To:   Rankin, Randy; [EMAIL PROTECTED]
 Subject:  Re: [PHP-DB] Help with MySQL Logic
 
  A client of mine, a rail car storage company, has asked that I create a
  PHP/MySQL application in which they will maintain and track rail cars. I
 am
  having a bit of trouble however working through one of thier
 requirements.
  They need to know in what position the rail car is on each track. For
  example, they might have a track called X which will hold 30 rail cars.
 They
  would enter the car information for 30 cars and associate each of them
 with
  track X. If one of the car owners decides to move car 3 out of storage,
 then
  the remaining 29 cars must be re-numbered ( ie; car 1 and 2 would remain
 and
  car 4-30 would become car 3-29 ). In the same manner, I need to be able
 to
  add a car to the track once an empty slot is available. For example, If
 the
  new car goes at the front of the track then it would become car 1 and
 the
  remaining cars, originally numbered 1-29 would become 2-30.
 
 Not sure if this helps or if you already realize this...
 
 Say you have a table that identifies the track_id and car_id. Now, you
 delete the car_id for car #3, like you've said. So, that row is deleted
 and
 you've got a hole now. You can run a query such as:
 
 UPDATE table SET car_id = car_id - 1 WHERE car_id BETWEEN 4 AND 30 AND
 track_id = XX
 
 to adjust all of the other car_id numbers.
 
 Now, say you want to add a new car to the beginning.
 
 UPDATE table SET car_id = car_id + 1 WHERE track_id = XX
 
 and then insert your new car at position #1.
 
 Throw in some checks to make sure you don't go over 30 cars and you should
 have it. You can get a count of how many cars are on a certain track with:
 
 SELECT COUNT(*) AS c FROM table WHERE track_id = XX
 
 Hope that helps. It sounds like a fun project.
 
 ---John Holmes...
 


[PHP-DB] Help with MySQL Logic

2003-03-03 Thread Rankin, Randy
Hello All,

This may be a bit off topic. If so, my apololgies. 

A client of mine, a rail car storage company, has asked that I create a
PHP/MySQL application in which they will maintain and track rail cars. I am
having a bit of trouble however working through one of thier requirements.
They need to know in what position the rail car is on each track. For
example, they might have a track called X which will hold 30 rail cars. They
would enter the car information for 30 cars and associate each of them with
track X. If one of the car owners decides to move car 3 out of storage, then
the remaining 29 cars must be re-numbered ( ie; car 1 and 2 would remain and
car 4-30 would become car 3-29 ). In the same manner, I need to be able to
add a car to the track once an empty slot is available. For example, If the
new car goes at the front of the track then it would become car 1 and the
remaining cars, originally numbered 1-29 would become 2-30. 

I hope I explained thourougly. Any suggestions would be appreciated. 

Randy


RE: [PHP-DB] Broken Links 2

2002-10-24 Thread Rankin, Randy
Thanks to everyone for the help. 

For those interested, I have posted the final code below. It functions
beautifully with one exception: the resized image quality is rather poor. I
am now reading through the php manual and newsgroups for a solution, but if
anyone knows how to handle this it would be great to hear from you.

Thanks again for all your help!

Randy 

- BEGIN CODE --

?
if( $image_id ) 
{
 $sql=SELECT image_bin_data from IMAGES where image_id='$image_id';
 $result=db_query ( $sql );
 $record=db_fetch_object ( $result );
 $image=$record-image_bin_data;
 $new_w=75;
 $new_h=75;
 Header(Content-type: image/png);
 $src_img=ImageCreateFromString($image);
 $dst_img=ImageCreate($new_w, $new_h);
 
ImageCopyResampled($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img)
,ImageSY($src_img));
 ImagePng($dst_img);
 ImageDestroy($dst_img);
};? 

- END CODE --



[PHP-DB] First record of array not being echoed

2002-10-14 Thread Rankin, Randy

Good morning all.

I am attempting to create a table in which there is a title cell populated
with a training wave number and then I would like to echo all members of
each training wave below the title cell (See example below for
clarification). All seems to be working with one exception. The first record
of each array is not being echoed. If I run the query in MySQL, all rows are
returned, so it must just be something I am not seeing in the code (which is
posted below). Thanks in advance for any help.

Randy

--  START EXAMPLE ---


Training Wave: I-02   
 
Brumley, Kennith 
Dillard, Lori 
Hamilton, Don 
Larsen, Gerry 
Robinson, Bobby 
Sarabi, Ray 
Shaddix, Kirby 
Springer, Leon 
 
Training Wave: II-02   
 
Boles, Scooby 
Deloney, Jerald 
Russell, Roger 
Smith, Martha 
Stockman, Joe 
Williams, Ed 

ETC, ETC, ...

--  END EXAMPLE --- 

  BEGIN CODE SNIPET -
?
$sql = SELECT u.last_name, u.first_name, w.wave_id, w.wave_num
FROM USERS u, WAVES w
WHERE w.wave_id = u.wave_id
AND u.plant_id = '$plant_id'
ORDER BY w.wave_id ASC, u.last_name ASC;

$result = db_query ( $sql );

for ( $i = 0; $i  db_num_rows ( $result ); $i++ )
{
$record = db_fetch_object ( $result );  

if ( $record-wave_num != $prior_wave )
{
$prior_wave = $record-wave_num;

?

table width=375 cellpadding=0 cellspacing=0
border=0 
tr
td colspan=2 height=10?php
echo FILLER; ?/td
/tr
tr height=20 bgcolor=? echo $color2; ?
tdb
class=bGraybnbsp;Training Wave: ? echo $prior_wave; ?/b/td
td align=rightnbsp;/td
/tr
tr
td colspan=2 height=10?php
echo FILLER; ?/td
 /tr
/table  

?
}
else
{
?

table width=575 cellpadding=0 cellspacing=0
border=0 
tr
tdnbsp; ? echo
$record-last_name . ,  . $record-first_name; ?/td
/tr
/table
?
}

   }
}
}
?

-  END CODE SNIPET
-



RE: [PHP-DB] First record of array not being echoed

2002-10-14 Thread Rankin, Randy

Thanks Marco!

It's working now. Based on your suggestion, here is waht I came up with.
It's working now.

Randy


  SNIP 

table width=375 cellpadding=0 cellspacing=0 border=0 
tr
td colspan=2 height=10?php echo FILLER; ?/td
/tr
tr height=20 bgcolor=? echo $color2; ?
tdb class=bGraybnbsp;Training Wave: ? echo $prior_wave;
?/b/td
td align=rightnbsp;/td
/tr
tr
td colspan=2 height=10?php echo FILLER; ?/td
/tr

--  ADDED THIS HERE ---
tr
tdnbsp; ? echo $record-last_name . ,  . $record-first_name;
?/td
/tr
---  END ADDED CODE 
 /table  

?
}
else
{
?

table width=575 cellpadding=0 cellspacing=0 border=0
tr
tdnbsp; ? echo $record-last_name . ,  .
$record-first_name; ?/td
/tr
/table
--  END SNIP 

  -Original Message-
 From: Marco Tabini [EMAIL PROTECTED]  
 Sent: Monday, October 14, 2002 7:17 AM
 To:   Rankin, Randy
 Cc:   [EMAIL PROTECTED]
 Subject:  Re: [PHP-DB] First record of array not being echoed
 
 It seems to me that the first time you go through the loop, if
 $record-wave_num is != $prior_wave then you print the wave number but
 not the person's name--but you already have a record there with a
 person's name!
 
 Try taking out the else statement--if you follow the code from there you
 should be able to fix it up.
 
 Of course, I'm also doing this by just looking at your code, so I may be
 wrong (the odds are not in my favor) :-)
 
 On Mon, 2002-10-14 at 07:58, Rankin, Randy wrote:
  Good morning all.
 
  I am attempting to create a table in which there is a title cell
 populated
  with a training wave number and then I would like to echo all members of
  each training wave below the title cell (See example below for
  clarification). All seems to be working with one exception. The first
 record
  of each array is not being echoed. If I run the query in MySQL, all rows
 are
  returned, so it must just be something I am not seeing in the code
 (which is
  posted below). Thanks in advance for any help.
 
  Randy
 
  --  START EXAMPLE ---
 
 
  Training Wave: I-02
 
  Brumley, Kennith
  Dillard, Lori
  Hamilton, Don
  Larsen, Gerry
  Robinson, Bobby
  Sarabi, Ray
  Shaddix, Kirby
  Springer, Leon
 
  Training Wave: II-02
 
  Boles, Scooby
  Deloney, Jerald
  Russell, Roger
  Smith, Martha
  Stockman, Joe
  Williams, Ed
 
  ETC, ETC, ...
 
  --  END EXAMPLE ---
 
    BEGIN CODE SNIPET
 -
  ?
  $sql = SELECT u.last_name, u.first_name, w.wave_id, w.wave_num
  FROM USERS u, WAVES w
  WHERE w.wave_id = u.wave_id
  AND u.plant_id = '$plant_id'
  ORDER BY w.wave_id ASC, u.last_name ASC;
 
  $result = db_query ( $sql );
 
  for ( $i = 0; $i  db_num_rows ( $result ); $i++ )
  {
  $record = db_fetch_object ( $result );
 
  if ( $record-wave_num != $prior_wave )
  {
  $prior_wave = $record-wave_num;
 
  ?
 
  table width=375 cellpadding=0 cellspacing=0
  border=0
  tr
  td colspan=2 height=10?php
  echo FILLER; ?/td
  /tr
  tr height=20 bgcolor=? echo $color2; ?
  tdb
  class=bGraybnbsp;Training Wave: ? echo $prior_wave; ?/b/td
  td align=rightnbsp;/td
  /tr
  tr
  td colspan=2 height=10?php
  echo FILLER; ?/td
   /tr
  /table
 
  ?
  }
  else
  {
  ?
 
  table width=575 cellpadding=0 cellspacing=0
  border=0
  tr
  tdnbsp; ? echo
  $record-last_name . ,  . $record-first_name; ?/td
  /tr
  /table
  ?
  }
 
 }
  }
  }
  ?
 
  -  END CODE SNIPET
  -
 
 



[PHP-DB] Confused

2002-09-23 Thread Rankin, Randy

I have two MySQL tables, groups and users:

groups: group_id, group_name
users:   user_id, user_name, group_id, etc.
 
I would like to produce one table for each group which will list all the
members for that particular group. For example:
 
Blue (group_id 1)
Tom (group_id 1)
Nancy (group_id 1)
Jim (group_id 1)
 
Red (group_id 2)
Bob (group_id 1)
Susan (group_id 1)
James (group_id 1)
 
...
 
My question is, do I need to run 2 queries? The first to select all the
groups and the second to select all the users in each group based on the
group_id? How would I loop through to create a table for each group? 
 
Thanks inadvance for any help.
 
Randy Rankin
 



RE: [PHP-DB] Determine last quarter

2002-03-20 Thread Rankin, Randy

If anyone is interested, this is what I finally came up with. I'm not sure
how graceful it is, but it works ;) 

?

$quarter = ceil(date('n')/3);

if ($quarter = 1)
{
$period_first_day = date(Y-m-d,
mktime(0,0,0,10,1,date(Y)-1));
$period_last_day = date(Y-m-d,
mktime(0,0,0,12,31,date(Y)-1));
}

elseif ($quarter = 2)
{
$period_first_day = date(Y-m-d,
mktime(0,0,0,1,1,date(Y)));
$period_last_day = date(Y-m-d,
mktime(0,0,0,3,31,date(Y)));
}

elseif ($quarter = 3)
{
$period_first_day = date(Y-m-d,
mktime(0,0,0,4,1,date(Y)));
$period_last_day = date(Y-m-d,
mktime(0,0,0,6,30,date(Y)));
}

elseif ($quarter = 4)
{
$period_first_day = date(Y-m-d,
mktime(0,0,0,7,1,date(Y)));
$period_last_day = date(Y-m-d,
mktime(0,0,0,9,30,date(Y)));
}

echo Start of Period: $period_first_daybr;
echo End of Period: $period_last_day;

?


-Original Message-
From: Rankin, Randy [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 19, 2002 8:57 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Determine last quarter


Hello all,

Does anyone know how I might determine the start date and end date of the
previous calendar quarter based on today's date. For example, today is
2002-03-19, so the previous quarter start date would return 2001-10-01 and
the previous quarter end date would return 2001-12-31. I am trying to
determine these dates for a report that generates previous quarter sales
based on today (whatever 'today' might be). Hope that's clear. 

Thanks in advance,

Randy Rankin



[PHP-DB] Determine last quarter

2002-03-19 Thread Rankin, Randy

Hello all,

Does anyone know how I might determine the start date and end date of the
previous calendar quarter based on today's date. For example, today is
2002-03-19, so the previous quarter start date would return 2001-10-01 and
the previous quarter end date would return 2001-12-31. I am trying to
determine these dates for a report that generates previous quarter sales
based on today (whatever 'today' might be). Hope that's clear. 

Thanks in advance,

Randy Rankin



RE: [PHP-DB] increase date()

2002-03-18 Thread Rankin, Randy

Try this:

$six_months_from_now = date(Y-m-d, mktime(0,0,0, date(m)+6, date(1),
date(Y)));
echo Six Months From Now: $six_months_from_nowP;

-Original Message-
From: its me [mailto:[EMAIL PROTECTED]]
Sent: Sunday, March 17, 2002 12:28 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] increase date()


i have:
$nowdate=date(Y-m-d);
and i   want to increase it by 6 months,how can i do that??


Rehab M.Shouman





-
Express yourself with a super cool email address from BigMailBox.com.
Hundreds of choices. It's free!
http://www.bigmailbox.com
-

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] creating a drop down menu from mysql categories

2002-03-14 Thread Rankin, Randy

Chad,

Try something like this:

-
?
$qry = SELECT category_id, category_name from tblCategories;
$result = mysql_query($query);
?  

form method=POST name=criteria action=my_postpage.php
select name=categories
?  
while ($category_array = mysql_fetch_array($result))
{ 
print OPTION
value=.category_array[category_id].
 
$category_array[category_name]/OPTION; 
} 

?
/select

-

Randy

-Original Message-
From: chad kellerman [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 14, 2002 6:47 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] creating a drop down menu from mysql categories


Hello everyone,

   I am a little new to the list.  I have been reading a lot of the posts
but have not submitted yet.  But I ran into a problem I was hoping I might
get e little help or at least get a point in the right direction.


   I have a table called tblCategories with field category_ID with is
auto_incremented and another field called category_name.

I wish to have a drop down menu on an html page that is generated
automatically with Category_name as the option and the option
value=category_ID.  It is going in a form which I submit and adds to a mysql
database.  Everything is working fine except I cannot create the drop down
menu out of php. I would rather not have to edit my html page when ever I
add a category.

   Is there any place I can look to see how someone else has accomplished
this?  Or is there any specific function I should research in the php.net
manual pages?  I have been looking but not too successfull.

thank you for any help you can offer.


-chad

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Dynamic Drop Down Box

2002-03-05 Thread Rankin, Randy

Does anyone know how I might populate a drop down box based on the users
selection from a previous drop down box? For example, if I have a table
called 'autos' with 2 fields, 'make' and 'model'. I select distinct 'make'
and populate the first drop down box. Based on the user selection, the 2nd
drop down box would be populated with the distinct 'make' for that model
(ie; if the user selects Ford in the first drop down, the 2nd drop down
would be populated with Explorer, Expedition, Ranger, etc.).

Thanks,

Randy Rankin



[PHP-DB] Dynamic Table Columns

2002-02-18 Thread Rankin, Randy

I have a form (criteria.php) that includes two drop down lists from which a
user can select a start period and an end period from a MySQL table. This
form posts to a form called order_summary.php on which I am using the
$start_period and $end_period variables from the criteria.php form to pull
data from another MySQL table which will produce a summary of sales for
those periods as illustrated by the following example: 

 $start_period $end_period$total
- 
 Order Type | APR-00| MAY-00| Total |
- 
 Widget 1   | $100  | $200  | $300  | 
 Widget 2   | $300  | $200  | $500  | 
. 
. 
. 

OK. Fine and good. I have this working. My problem is this: 

How can I create a table which will dynamically adjust the number of columns
based on the users request. That is, if the user requests APR-00 through
MAY-00, the table will be built as illustrated above.  If the user requests
JAN-01 through JUN-00, the table will be built as illustrated below: 

 $start_period  through
$end_period

-- 
 Order Type | JAN-01| FEB-01| MAR-01| APR-01|
MAY-01  | JUN-01|Total  |

-- 
 Widget 1   | $100  | $200  | $300  | $300  | $300  | $300  | $300  |
 Widget 2   | $300  | $200  | $500  | $300  | $300  | $300  | $300  |
. 
. 
. 

I have posted order_summary.php below. 

Any thoughts? 

Thanks, 

Randy Rankin

  order_summary.php
**

?
session_register($dbname);
?

?
require(./includes/salesdb.inc);

$query_first_last_period = select period_id, period_name
from periods
where period_id between $start_period_id and $end_period_id
GROUP BY period_id
HAVING period_id = $start_period_id OR period_id = $end_period_id
ORDER BY period_id;

$result_first_last_period = mysql_query($query_first_last_period);

$row = mysql_fetch_row($result_first_last_period);

for( $i= 0; $icount($row);$i++ )
{
if( $i == 0 )
$start_period_name = $row[$i];
elseif( $i == (count($row)-1) )
$end_period_name = $row[$i];
}

echo font face=Tahoma size=2 color=#333999;
echo Salesperson: b$dbname/bbr;
echo Report Period: b$start_period_name through $end_period_name/b;
echo /fontP;

echo table border=0 cellpadding=2 cellspacing=2;
echo tr bgcolor=#99font face=Tahoma size=2 color=#ff;
echo th align=left bordercolor=#808080font color=#FF face=Tahoma
size=2bCategory/b/font/th;

//   Start Get the Order Summary Data ***

$sql_order_summary = SELECT order_type, SUM(extended_dollars)
from salesdata
where salesperson = '$dbname'
and period_id between '$start_period_id' and '$end_period_id' 
group by order_type;
$result_order_summary = mysql_query($sql_order_summary) or die (I can't get
the sales data!);

//   Stop Get the Order Summary Data ***

//   Start Get the Period Names for the Table Header
***

$sql_period_name = Select period_name
from periods
where period_id between '$start_period_id' and '$end_period_id'
order by period_id;
$result_period_name = mysql_query($sql_period_name) or die (I can't get the
period name!);

//   End Get the Period Names for the Table Header
***

//   Build and Print the Table Headers ***

$num_periods = mysql_numrows($result_period_name);

if ($num_periods == 0) 

{
echo font color=#ffbThere were no records found for
the periods selected./b/font;
}

else 
while ($row = mysql_fetch_array($result_period_name))
{

$period_name = $row[period_name];

echo th align=left bordercolor=#808080font
color=#FF face=Tahoma size=2
b$period_name/b/th
/font;
}

echo th align=left bordercolor=#808080font
color=#FF face=Tahoma size=2bTotal Sales/b/font/th;
echo /tr;



//   End Build and Print the Table Headers
***

//   Start Calculate and Format Total Sales
***

$get_itemtot = SELECT SUM(extended_dollars) 
FROM salesdata 
WHERE salesperson = '$dbname'
and period_id between '$start_period_id' and '$end_period_id' ;
$itemtot_result 

[PHP-DB] First and Last Record Query

2002-02-13 Thread Rankin, Randy

Does anyone know how to grab only the first and last record of a query. 

I have a table named periods with two fields, period_id and period_name. The
user will select a start period and an end period from a drop down list,
assigning $start_period and $end_period variables based on the period id. If
I run this query:

Select period_name
from periods
where period_id between '$start_period_id' and '$end_period_id'
order by period_id

An array is returned which could include one or more records, depending upon
the user selection. I would like to grab the first and last record in the
array so that the final result would be to echo something like This report
is from $start_period through $end_period.

Hope that makes sense ...

Thanks in advance for any help. 

Randy Rankin



RE: [PHP-DB] First and Last Record Query

2002-02-13 Thread Rankin, Randy

 Why are you iterating through the array?

Inexperience. 

Thanks for the help guys. I'll give it a try. 

Randy

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 11:43 AM
To: 'David Fudge'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] First and Last Record Query


Why are you iterating through the array?  Why not just:

$start_id = $row[0];
$end_id = $row[count($row)-1];

-Original Message-
From: David Fudge [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 11:40 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] First and Last Record Query


well, if you're using an array, you could use a for like this:

$row = mysql_fetch_row($result);
for( $i=0;$icount($row);$i++ )
{
if( $i==0 )
$start_id = $row[$i];
elseif( $i == (count($row)-1) )
$end_id = $row[$i];
}


- Original Message -
From: Rankin, Randy [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, February 13, 2002 12:32 PM
Subject: [PHP-DB] First and Last Record Query


 Does anyone know how to grab only the first and last record of a query.

 I have a table named periods with two fields, period_id and period_name.
The
 user will select a start period and an end period from a drop down list,
 assigning $start_period and $end_period variables based on the period id.
If
 I run this query:

 Select period_name
 from periods
 where period_id between '$start_period_id' and '$end_period_id'
 order by period_id

 An array is returned which could include one or more records, depending
upon
 the user selection. I would like to grab the first and last record in the
 array so that the final result would be to echo something like This
report
 is from $start_period through $end_period.

 Hope that makes sense ...

 Thanks in advance for any help.

 Randy Rankin



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] OCI Query Results

2001-12-12 Thread Rankin, Randy

We are using OCI to query an Oracle DB. Everything seems to work fine (i.e;
data is returned to the browser), however, the first record of every
recordset is NOT returned. I can run the same query in SQLPlus and all
records are returned. It seems something in PHP is stripping of the first
record in the result set. Does anyone have any thoughts. I can post code
sample if needed.

Randy



RE: [PHP-DB] OCI Query Results

2001-12-12 Thread Rankin, Randy

Nevermind, I figured it out.  There was a duplicate OCIfetchinto statement
in the script.

Randy

-Original Message-
From: Rankin, Randy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 12, 2001 10:12 AM
To: PHP List
Cc: Barker, John
Subject: [PHP-DB] OCI Query Results


We are using OCI to query an Oracle DB. Everything seems to work fine (i.e;
data is returned to the browser), however, the first record of every
recordset is NOT returned. I can run the same query in SQLPlus and all
records are returned. It seems something in PHP is stripping of the first
record in the result set. Does anyone have any thoughts. I can post code
sample if needed.

Randy



RE: [PHP-DB] Connection to Oracle8i

2001-08-16 Thread Rankin, Randy

Rafael,

I am assuming you can connect to your Oracle server from your client (using
net8 for example). 

Did you recompile PHP with Oracle OCI support on your web server? 
Run ?phpinfo()? and see if there is a section on Oracle OCI. If not, that
may be at least part of your problem. Remember that Oracle and OCI8 support
for PHP are different. You can compile PHP with one or both.

Can you post the section of code with regards to line 40 in your oracle.php3
file. That might help too. 

I am not familiar with the oracle_connect() function you are trying to call.
For your reference, here is an example of a connect script that I run using
OCI calls:

%
$connection = OCILogon (user,pass,sid); 
if ($connection == false)
{echo OCIError($connection).BR; 
exit; 
} 

OCILogoff ($connection); 

% 

Hope that helps, 

Randy Rankin
Texarkana, Texas

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 15, 2001 3:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Connection to Oracle8i


I have a server runs Oracle. And my Station is Linux and i run client for
Oracle in it, with the variables of ORACLE_HOME, ORACLE_SID and other
is in the bash_profile of my user. Then i change de httpd.conf to apache
runs with my users and group.

I use PHP4 in a REDHAT 7.1.

My problem is whem i put the connection in the PHP script use OCI.they
not find the command. The apache send me the following error:

Fatal error: Call to undefined function: oracle_connect() in
/var/www/html/teste/oracle.php3 on line 4

I nead to include any class in my script.
I look the manual on php.net, but it can´t help me.
if someone has a tutorial of the connection of PHP with Oracle, please,
send me.
Sorry, my english, i´m from Brazil.
Thank´s
Rafael



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Query on Oracle Views

2001-08-06 Thread Rankin, Randy

I am connecting to an Oracle 8 server using OCI, PHP and Apache on a RH
Linux 7.1 box. 
All works well until I try to query an Oracle dynamic view like the
following:

$query = SELECT instance_name, host_name FROM v$instance; 

When I execute this query, the server returns the following error. 
Warning: OCIStmtExecute: ORA-00942: table or view does not exist in
/usr/local/apache/htdocs/oracle/oraprod.php on line 17

My suspicion is that PHP thinks that the '$' in the table name is the
beginning of a variable. Does anyone know how to get around this so that I
can execute a query with a table name like v$instance?

TIA,

Randy Rankin





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Escaping

2001-07-13 Thread Rankin, Randy

Thanks to all for your help. I had to step away for a while yesterday so I
am just now getting back to your responses.

Here is what I was having a problem with:
a href=\sales_location.php?Customer=$Customer\
target=bottom_right$Customer/a


Based on your responses, here is what I have now (this works!):
a href=\sales_location.php?Customer= . urlencode($Customer) .\
target=bottom_right$Customer/a


As you can see, urlencode did the trick. Thanks again everybody!!

Randy Rankin



-Original Message-
From: Ken Sommers [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 12, 2001 10:27 PM
To: Rankin, Randy; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Escaping 


Please explain the dynamic link .
is that in the documentation somewhere?

Kne
- Original Message -
From: Rankin, Randy [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, July 12, 2001 8:18 AM
Subject: [PHP-DB] Escaping 


 Hello,

 I have a table in a MySQL DB (RH Linux/Apache) with a field called
 customer_name. Some of the customer names have an ampersand in them (ie; X

 X Supply). I am performing a select statement on this table to create a
 sales summary with customer name and total sales.

 This works fine; however, I am also creating a dynamic link on the
customer
 name so that the user can click on it to get a detailed report of sales to
 that customer. This works great EXCEPT for the customers with ampersands
in
 thier names. The result of clicking on these customers indicates a No
 Records found for X where X is the letter immediately preceding the
 ampersand.

 Does anyone know how to get around this?

 TIA,

 Randy Rankin

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Escaping

2001-07-12 Thread Rankin, Randy

Hello,

I have a table in a MySQL DB (RH Linux/Apache) with a field called
customer_name. Some of the customer names have an ampersand in them (ie; X 
X Supply). I am performing a select statement on this table to create a
sales summary with customer name and total sales.

This works fine; however, I am also creating a dynamic link on the customer
name so that the user can click on it to get a detailed report of sales to
that customer. This works great EXCEPT for the customers with ampersands in
thier names. The result of clicking on these customers indicates a No
Records found for X where X is the letter immediately preceding the
ampersand.

Does anyone know how to get around this?

TIA, 

Randy Rankin

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] odbc with ms access

2001-05-22 Thread Rankin, Randy



http://www.microsoft.com/KB/Articles/Q128/8/08.HTM

-Original Message-
From: Dalyyla [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 22, 2001 7:32 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] odbc with ms access


hi,

Access to data with ms access via odbc is kinda slow . I would like to
know if it is normal and what can i do to make it faster

Thanks

Dalyyla


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] PHP On Linux

2001-04-20 Thread Rankin, Randy

Try this:

http://www.devshed.com/Server_Side/PHP/SoothinglySeamless/

Randy Rankin

Ben Cairns wrote:
 
 I have nearly 18 Months devel on Windows, but we are now moving to Linux,
 
 I have never installed PHP On Linux before, so could someone pls give me
an
 'Installation Guide' to follow for PHP With MySQL Support, on Linux,
 
 Also, I would like to know what I have to do with MySQL: You know, what
files
 go where etc...
 
 Thanks.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]