In my code I make two inserts using the Adodb 5 library, with the MySQL driver for PHP.
But at times it happens that the function Insert_ID()
returns an id (primary key) of an insert earlier than it does at the moment, the two inserts run smoothly , this can happen if the second insert returns a timeout , and it can return a timeout ?
Example Code
// Primeiro Insert
$db->Execute("INSERT INTO table_1 VALUES ('1')");
// Pega o primeiro id
$id_1 = $db->Insert_ID();
// Segundo Insert
$db->Execute("INSERT INTO table_2 VALUES ('1')")
// Pega o segundo id inserido
$id_2 = $db->Insert_ID(); /* Em certos momento pega o ID do primeiro Insert */