Maybe my question is stupid, but there is one thing I want to know about mysql_insert_id(). The following is written on php.net:
Gets the identifier generated for the AUTO_INCREMENT column by the previous query (usually INSERT).
What will this this function output if earlier the script reaches the line where mysql_insert_id()another script is used, inserts something into the database?
As far as I know, it will return the identifier of the last inserted element (it doesn't matter where it came from). If I'm right, I want to know how to avoid this problem, but with the help mysql_insert_id()immediately after the execution of the insert request (because there is still a small chance to get into the "problem").
source
share