Liquid Fire Posted January 12, 2008 Share Posted January 12, 2008 What is the safest and fastest way to securely get the id from the last insert of mysql with php. the mysql_insert_id does not seem very good if there are hig volumes of insert into the same table. Quote Link to comment https://forums.phpfreaks.com/topic/85685-solved-safest-way-to-get-insert-id/ Share on other sites More sharing options...
Barand Posted January 12, 2008 Share Posted January 12, 2008 Mysql_insert_id() retrieves the last id inserted by your current connection. Other users have different connections. Quote Link to comment https://forums.phpfreaks.com/topic/85685-solved-safest-way-to-get-insert-id/#findComment-437311 Share on other sites More sharing options...
fenway Posted January 12, 2008 Share Posted January 12, 2008 What is the safest and fastest way to securely get the id from the last insert of mysql with php. the mysql_insert_id does not seem very good if there are hig volumes of insert into the same table. In fact, this is only way. Quote Link to comment https://forums.phpfreaks.com/topic/85685-solved-safest-way-to-get-insert-id/#findComment-437517 Share on other sites More sharing options...
Liquid Fire Posted January 13, 2008 Author Share Posted January 13, 2008 I remember trying that before and it would not work, do I have to pass it the mysql resource id? Quote Link to comment https://forums.phpfreaks.com/topic/85685-solved-safest-way-to-get-insert-id/#findComment-438035 Share on other sites More sharing options...
Barand Posted January 13, 2008 Share Posted January 13, 2008 ... do I have to pass it the mysql resource id? Only if using multiple connections. It will default to the current open connection Quote Link to comment https://forums.phpfreaks.com/topic/85685-solved-safest-way-to-get-insert-id/#findComment-438177 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.