mysql_insert_id() will return me the the last auto_increment id from the last insert.
It is supposed to call right after the insert statement.
From mysql document
"The last ID that was generated is maintained in the server on a per-connection basis. This means the value the function returns to a given client is the most recent AUTO_INCREMENT value generated by that client. The value cannot be affected by other clients, even if they generate AUTO_INCREMENT values of their own. This behavior ensures that you can retrieve your own ID without concern for the activity of other clients, and without the need for locks or transactions."
How the logics work here if I use it in php?
If two people use the same web site php page to connect to the mysql database. Are they consdiered as one same mysql user?
So if they both issue the insert at the same time, will the mysql_insert_id() get confused?
Or they are the same user but different connection thread, so the mysql_insert_id() will not get confused?
Does it make any difference if I use mysql_connect or mysql_pconnect when calling mysql_insert_id()?
If my last insert failed, did I get the last successful insert of my connection? Or did I get the last successful insert id of this user?
Thanks!