Is it safe to assume that the auto increment id from a insert with multiple rows will be incremented by one starting to the mysql_last_insert_id() value? Could there be a concurrent insert (from an other user session) between this multiple insert?
In this example tbl_name has an autoincrement field called id:
INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9); $nbAffectedRows = mysql_affected_rows(); $idFirstRowInserted = mysql_last_insert_id(); $arrayId = array(); if($nbAffectedRows > 0){ for($i = 0; $i <= $nbAffectedRows; $i++){ $arrayId[] = $idFirstRowInserted + $i; } } Will $arrayId always contain values incremented by one correponding to the 'id' of the rows inserted ?
show variables like 'auto_increment_increment';