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?
Returning An Auto_Increment
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
You can use PHP's mysql_insert_id() function immediately after the INSERT in order to get the ID.
Mac
Mac