eludlow Posted May 21, 2008 Share Posted May 21, 2008 If I insert a row that has an auto_increment value (use it as row id field..) but then I want to use that id value immediately after the insert is complete (I am sending a mail containing, amongst other things, the latest id), what is the best way of getting the latest value? So for instance I have: mysql_query("INSERT INTO `table` VALUES ('', 'field two')"); And the first field in the above is the auto_increment field. I obviosuly don't know what the value of that is to now SELECT the row in question. Hope this makes sense! Many thanks, Ed Ludlow Quote Link to comment Share on other sites More sharing options...
eludlow Posted May 21, 2008 Author Share Posted May 21, 2008 Solved, mysql_insert_id() is my new best friend Ed Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.