Vinze Posted March 24, 2007 Share Posted March 24, 2007 Hey, if I've just created a new entry in a table with ID set to auto_increment, how can I find out the new ID? Is that possible without another query? Quote Link to comment https://forums.phpfreaks.com/topic/44142-solved-how-can-i-find-out-the-id-of-a-just-created-entry/ Share on other sites More sharing options...
paul2463 Posted March 24, 2007 Share Posted March 24, 2007 $lastid = mysql_insert_id(); echo $lastid; // prints out the last autoincremented id Quote Link to comment https://forums.phpfreaks.com/topic/44142-solved-how-can-i-find-out-the-id-of-a-just-created-entry/#findComment-214342 Share on other sites More sharing options...
Vinze Posted March 24, 2007 Author Share Posted March 24, 2007 $lastid = mysql_insert_id(); echo $lastid; // prints out the last autoincremented id Awesome, thanks! Quote Link to comment https://forums.phpfreaks.com/topic/44142-solved-how-can-i-find-out-the-id-of-a-just-created-entry/#findComment-214347 Share on other sites More sharing options...
MadTechie Posted March 25, 2007 Share Posted March 25, 2007 Click Solved Quote Link to comment https://forums.phpfreaks.com/topic/44142-solved-how-can-i-find-out-the-id-of-a-just-created-entry/#findComment-214709 Share on other sites More sharing options...
Vinze Posted March 25, 2007 Author Share Posted March 25, 2007 Click Solved Sorry Quote Link to comment https://forums.phpfreaks.com/topic/44142-solved-how-can-i-find-out-the-id-of-a-just-created-entry/#findComment-214710 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.