you can use the mysql function LAST_INSERT_ID() heres the info from the manual: http://dev.mysql.com/doc/mysql/en/ODBC_and_last_insert_id.html
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