Page 1 of 1

Returning An Auto_Increment

Posted: Fri Nov 15, 2002 9:46 am
by nonny
When sending a INSERT query to insert a row into a mySQL table, i wish to have it return the auto_increment assigned to the ID field of the new record.
I could use a seperate query and use the LAST_INSERT_ID () to return the ID of the last field, but is there a quicker way?

Posted: Fri Nov 15, 2002 9:48 am
by twigletmac
You can use PHP's mysql_insert_id() function immediately after the INSERT in order to get the ID.

Mac