RE: [PHP] How do I get last inserted ID?

From: Date: Fri, 02 Feb 2001 03:48:31 +0000
Subject: RE: [PHP] How do I get last inserted ID?
Groups: php.general 
Request: Send a blank email to php-general+get-37778@lists.php.net to get a copy of this message
mysql_insert_id() is a PHP function for it. however I recommend you using a build-in SQL function LAST_INSERT_ID(). i.e: INSERT INTO table SET name='$name', surname='$surname'; UPDATE table SET name='$name', surname='$surname' WHERE id=LAST_INSERT_ID() Cheers, Maxim Maletsky -----Original Message----- From: Sandeep Hundal [mailto:sandeep_wde@yahoo.com] Sent: Friday, February 02, 2001 12:44 PM To: PHP General Subject: [PHP] How do I get last inserted ID? Hi All, just a quick question. Say my script is inserting values into a database, which has an autoincremental id. Now I usually send out a mail also with the contents of the inserted stuff. The only problem is that of the ID field. How can I get the script to determine what id number was given to that row? thanks /sunny __________________________________________________ Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#37778) next »