RE: [PHP-DB] get the record id of the last addition in a table

From: Date: Tue, 27 Nov 2001 13:23:24 +0000
Subject: RE: [PHP-DB] get the record id of the last addition in a table
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-14588@lists.php.net to get a copy of this message
If you don't necessarily want to know what the next id should be and just want it inserted for the next item added to the database, when you do the insert statement, use '' as the value for that field. matt stewart <matt@netvirtua.com> said: > $last_add = mysql_insert_id(); > - thanks to Bruno Gimenes Pereti who answered this very same question when i > asked it a couple of weeks ago ;) > > all the best, > Matt > > > -----Original Message----- > From: LeTortorec, Jean-Louis [mailto:JLeTortorec@healthcore.com] > Sent: 26 November 2001 22:22 > To: 'php-db@lists.php.net' > Subject: [PHP-DB] get the record id of the last addition in a table > > > Hi: > > I've created a table. The fields are "id" (auto-increment, integer), > "field1","field2),... > > When I do "insert into mytable (field1..) values (...)", how to get in > return the value of "id"? > > Thanks > > > > Jean-Louis > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01 > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01 > > > -- > 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 > --

« previous php.db (#14588) next »