acidglitter Posted December 8, 2007 Share Posted December 8, 2007 There was this really simple code and I can't remember what it was and I can't find it.. But right after you inserted something into a table you would do something like mysql_newest_id() and it would get the id of the row just barely entered without having to start a new query and fetch it.. Does anyone know what that code is? Quote Link to comment Share on other sites More sharing options...
dbo Posted December 8, 2007 Share Posted December 8, 2007 mysql_last_insert_id() or something like that maybe just mysql_insert_id() Quote Link to comment Share on other sites More sharing options...
emehrkay Posted December 8, 2007 Share Posted December 8, 2007 I recently asked this question. Run this query SELECT LAST_INSERT_ID() AS last_id Quote Link to comment Share on other sites More sharing options...
acidglitter Posted December 8, 2007 Author Share Posted December 8, 2007 mysql_insert_id(); works. Thanks! Quote Link to comment Share on other sites More sharing options...
acidglitter Posted December 8, 2007 Author Share Posted December 8, 2007 I recently asked this question. Run this query SELECT LAST_INSERT_ID() AS last_id I think the other way is faster though.. It doesn't even need any queries. 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.