RE: [PHP-DB] mysql_insert_id problems
| From: | Sam Masiello | Date: | Fri, 21 Jul 2000 11:41:21 +0000 |
| Subject: | RE: [PHP-DB] mysql_insert_id problems | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-1396@lists.php.net to get a copy of this message | ||
Perhaps I am not reading this right, but it almost sounds like you are using
mysql_insert_id() when you are going to INSERT the values into your table.
Mysql_insert_id() is meant to get the last auto_incremented value already
inserted into the table (thus, it shouldn't be used until AFTER your insert
into the table).
Is this what you are doing and I just read it wrong?
Sam Masiello
System Analyst
Chek.Com
(716) 853-1362 x289
smasiello@chekinc.com
-----Original Message-----
From: Chris Newman [mailto:chris@lightwood.net]
Sent: Friday, July 21, 2000 4:53 AM
To: php-db@lists.php.net
Subject: [PHP-DB] mysql_insert_id problems
I have a system which shoots off an email with a reference number every time
a record is entered into MySQL. The reference number is formed from the
value of an auto_increment field using mysql_insert_id().
However yesterday a few cracks started appearing - it's sent out emails
containing the same reference number twice, though the database looks sound
(no problems found with isamchk) and it's only inserted one record (the
other one is lost, not just inserted with the next available ID). Are there
any known problems with mysql_insert_id() that might cause this to happen?
Thanks
Chris Newman
Lightwood Consultancy Ltd
chris@lightwood.net
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net