Re: A small question - Mysql_insert_id

From: Date: Sun, 02 Jun 2002 03:48:22 +0000
Subject: Re: A small question - Mysql_insert_id
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-100224@lists.php.net to get a copy of this message
Hey Julie, Thanks for replying, Actually the ID field is not null,primary and auto_increment. Thanks for the URL but in my message I did quote the line from that same url (http://www.php.net/manual/en/function.mysql-insert-id.php) I just need to get the ID of the just inserted record. Any ideas? Cheers, -Ryan. > r> I am inserting a row into a table with this structure > r> id (auto increment) > ... > > Assuming you mean ID int not null primary key auto_increment (or > something like that). > > r> Then according to the manual I have to use (to quote) > r> "printf ("Last inserted record has id %d\n", mysql_insert_id());" > > r> will this return the row number or the "id" fields value..? > > FYI, you could: > a) try it and see > b) see what the manual has to say: http://www.php.net/manual/en/function.mysql-insert-id.php > > The answer is "Gets the id generated from the previous INSERT > operation". > > > - Julie > > --> Julie Meloni > --> julie@thickbook.com > --> www.thickbook.com > > Find "Sams Teach Yourself MySQL in 24 Hours" at > > http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20 >

« previous php.general (#100224) next »