I'm sorry to be so obtuse, but I still don't get it ...
I've tried:
$sql = INSERT INTO orders set products_ordered='$products',
ordered_by='$username', company='$company', address_1='$address_1',
address_2='$address_2', city='$city', state='$state', zip='$zip',
attn='$attn', special_instructions='$special_instructions',
shipping_instructions='$shipping_instructions', status='$status',
rush='$rush', date_ordered='$current_time' , month_due='$month_due',
day_due='$day_due'
;
$result = mysql_query($sql) or die(ERROR -- try again11 or see Kenn
Murrah);
$order_number=mysql_insert_id;
and I'm still not getting a value for $order_number, the
auto-incremented value.
I'm REALLY sorry to waste the list's time with this ... but I do appreciate
the help from all of you ...
Kenn
- Original Message -
From: Brunner, Daniel [EMAIL PROTECTED]
To: 'Kenn Murrah' [EMAIL PROTECTED]
Cc: PHP List (E-mail) [EMAIL PROTECTED]
Sent: Thursday, August 16, 2001 12:39 PM
Subject: RE: [PHP-DB] determining the value of an auto-incremented field
(mysql)
| Say...
|
|
| You can us it after you do your insert...then do something like.
|
| echo (BYour new Order Number is) . mysql_insert_id . (nbsp;Please
| write this down/B\n);
|
| Your whatever you want.
|
|
| Dan
|
|
|
| --
| From: Kenn Murrah
| Sent: Thursday, August 16, 2001 12:29 PM
| To: Brunner, Daniel
| Subject: Re: [PHP-DB] determining the value of an
| auto-incremented field (mysql)
|
| thanks, Dan ... i'll RTFM now to figure out exactly how to use it ...
|
| and thanks again for your prompt response ...
|
| Kenn
|
|
|
| - Original Message -
| From: Brunner, Daniel [EMAIL PROTECTED]
| To: 'Kenn Murrah' [EMAIL PROTECTED]
| Sent: Thursday, August 16, 2001 12:25 PM
| Subject: RE: [PHP-DB] determining the value of an auto-incremented
| field
| (mysql)
|
|
| | Hello!!
| |
| |
| |
| | mysql_insert_id()
| |
| |
| | Dan
| |
| |
| |
| | --
| | From: Kenn Murrah
| | Sent: Thursday, August 16, 2001 12:17 PM
| | To: [EMAIL PROTECTED]
| | Subject: [PHP-DB] determining the value of an auto-incremented
| | field (mysql)
| |
| | Greetings:
| |
| | A no doubt elementary question, but
| |
| | using PHP and MySQL, I'm inserting a record into a table, with a
| | field,
| | order_number, being auto incremented ... something like:
| |
| |
| | $sql = INSERT INTO orders set products_ordered='$products',
| | ordered_by='$username', company='$company',
| address_1='$address_1',
| | address_2='$address_2', city='$city', state='$state', zip='$zip',
| | attn='$attn', special_instructions='$special_instructions',
| | shipping_instructions='$shipping_instructions', status='$status',
| | rush='$rush', date_ordered='$current_time' ,
| month_due='$month_due',
| | day_due='$day_due'
| |;
| |
| | $result = mysql_query($sql) or die(ERROR -- try again);
| |
| |
| |
| | Having done so, how can I immediately determine the value of
| | order_number
| | for this entry, i.e. the auto-incremented value assigned by MySQL?
| |
| | Thanks in advance for the help.
| |
| | Kenn Murrah
| |
| |
| |
| |
| | --
| | 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]