faqts : Computers : Programming : Languages : PHP : Database Backed Sites : MySQL

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

26 of 30 people (87%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

Do I have to lock the table when using mysql_insert_id()?

Mar 10th, 2006 08:05
Praveen Kumar Kukkapalli, Nathan Wallace, Brian Moon


No.
mysql_insert_id() holds the last id generated by that script.  So if two
scripts run simultaneously they will each get their respective id's when
they call mysql_insert_id().
http://www.php.net/manual/function.mysql-insert-id.php3