I have a form that is going to insert a record into a database. the database contains a unique id column. right now i have it setup to set the unique record to the last id + 1. Problem is what if two ppl go to enter at the same time before one submits they will get the same id number and the one that finsishes last is going to overwrite the prior. Is there a way to auto create the next unique record as soon as they load the page? so i do not have this issue
found work around… i just did a reverse search in the mail.php and grab the last unique id stored as it would be the one they stored one second before.
Most (if not all) SQL databases auto-update their auto_increment columns, and allow you to retrieve the last inserted ID through a special function in PHP. That way, you can guarantee that every record in your table has a truly unique ID.