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?
The mysqli_insert_id() function returns the id (generated with AUTO_INCREMENT) from the last query.
Return Values PHP mysqli_insert_id() function returns the value of the "Auto Increment" column in the last query In case it is INSERT or, UPDATE operation. If the last executed query is not INSERT or, UPDATE or, if the table doesn't have any column/field with "AUTO_INCREMENT" attribute, this function returns 0.
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.
No. How can I be so sure? Because it would have been reported and fixed a long time ago.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With