mysql_insert_id() or LAST_INSERT_ID()
Posted on 2009-02-14
I need to do like >
$sql=mysql_query("INSERT INTO blog (id, subject) VALUES (NULL,'mytext')");
just after this I need to insert another information in another table where I need to set same Unique ID of last query like :
$sql2=mysql_query("INSERT INTO blog2 (id, subject) VALUES (mysql_insert_id(),'second text')");
Though this all works fine but I am wondering what if 1000 users are visiting the site same time and inserting rows so could it be incorrect because of it . what after executing first line from a users PC and before second line if some other user execute the same the code ?