I wonder how it works lastInsertId(). Atm, I use it to get the ID of the inserted row, so I can use this identifier in other sections of the code. For example:
$stmt = $db->prepare('INSERT INTO image_table (image_name, image_size) VALUES (:image_name, :image_size)');
$stmt->execute(array(
'image_name' => $photoName,
'image_size' => $image_size / 1024,
));
$lastInsertId = $db->lastInsertId('yourIdColumn');
Ok, my question is:
1) . Does this script get lastInsertIdto insert the SQL that was executed in this script?
2) That, for example, let's say 3 different users inserted data into the same table for just a few seconds. Something like that:
this script -> Inserts to row id 1
Another user -> Inserts to row id 2
Another user -> Inserts to row id 3
lastInsertId() 1, , script, 3, script , lastInsertId()?