RE: [PHP] SQL>Insert and recover the ID
| From: | John Meyer | Date: | Thu, 31 Oct 2002 21:40:58 +0000 |
| Subject: | RE: [PHP] SQL>Insert and recover the ID | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-122340@lists.php.net to get a copy of this message | ||
use mysql_insert_id(). Much more reliable when and if you use the system
with more than one person inserting at the same time.
-----Original Message-----
From: Christian Ista [mailto:mailing-list@istasofts.com]
Sent: Thursday, October 31, 2002 2:12 PM
To: php-general@lists.php.net
Subject: [PHP] SQL>Insert and recover the ID
Hello,
In a table, I have some fields and the primary key is an autoincrement
field. I insert an row and I'd like to recover the ID used for the last
record I inserted.
For the moment, I do a select max(Id) just after the insert but there
is, my be a best way to do it.
Thanks for your help
Christian,
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php