Just got a query i'm inserting records into a table the an auto counter primary key lets say its called ID.
After i insert a record i fetch the new unique ID created with SELECT last_insert_id() FROM mytable to build my audit trail and know what record to audit. That is my unique key.
What i want to know what if 2 users add a record at the same time by any chance, will the select last_insert_id fetch the right record id, by user.
Just need to make sure that won't cause a problem in the future even tho the chances of that happening is slim.
After i insert a record i fetch the new unique ID created with SELECT last_insert_id() FROM mytable to build my audit trail and know what record to audit. That is my unique key.
What i want to know what if 2 users add a record at the same time by any chance, will the select last_insert_id fetch the right record id, by user.
Just need to make sure that won't cause a problem in the future even tho the chances of that happening is slim.