phpmysqlmysqlihigh-traffic

Is it possible for mysqli_insert_id to return an incorrect id in high traffic applications?


In a high traffic application, is it possible for mysqli_insert_id() to return the wrong id, or to confuse the id between two INSERT queries performed nearly simultaneously?


Solution

  • No. mysqli_insert_id returns the most the AUTO_INCREMENT value from the most recent INSERT query on the current connection. It will never get confused with another connection, for example.