Re: How do I get last inserted ID?

From: Date: Fri, 02 Feb 2001 11:49:42 +0000
Subject: Re: How do I get last inserted ID?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-37821@lists.php.net to get a copy of this message
Hello, Sandeep! Friday, February 02, 2001, 08:43:41, you wrote: SH> just a quick question. Say my script is inserting values into a SH> database, which has an autoincremental id. Now I usually send out a SH> mail also with the contents of the inserted stuff. The only problem SH> is that of the ID field. How can I get the script to determine what SH> id number was given to that row? for mysql there is a function called mysql_insert_id(). that function returns the ID generated for an AUTO_INCREMENT column by the previous INSERT query. try to dig documentation if you using another db. Best regards! Andrew Golovin PGP Fingertip 24FD A0CD 667C 1FC7 C2F7 A2EA 9742 D484 FD3C 598D http://exper.ural.ru/

« previous php.general (#37821) next »