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: [EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php