I have a registration form. If a user starts the form I insert a empty row in my mysql-table and get the last id like that:
$db=startConnection();
$query=" INSERT INTO form VALUES ()";
$result=$db->query($query)
or die($db->error);
$id=$db->insert_id;
But now I worry - isn't it possible that two users register at the same time and both get the same $id from the code above? For example, if two people hit the registration form at the same time and both "insert" queries are executed, and afterwards both people will get the same last insert_id?