Re: Re: last insert ID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You can use the mysql_insert_id() function, it returns the id generated by the last query executed on the connection... hope this helps..

Zu3Bi

I was having trouble with retrieving the last insert id as well. Even after looking over the information in the link, I couldn't figure out how to make this work in PHP. Using the statement:

   $id = $link->query("SELECT LAST_INSERT_ID()");

$id turned out to be a huge array - no part of which seemed to contain the expected 'last id'. I can't even determine if I got any part of it right.

Does anyone have a more complete example?  I'm lost.

I'm surprised that the DB library doesn't do this. Is there some reason that it cannot or is it just waiting for someone to write the code?

Thank you for any assistance,
Nelson


-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux