CREATE TABLE `testinsertId` (
`i` INT NOT NULL AUTO_INCREMENT ,
`v` VARCHAR( 5 ) DEFAULT 'x' NOT NULL ,
PRIMARY KEY ( `i` )
);

Une table 2 champs l'entier en auto_increment.

INSERT INTO `testinsertId` v Values 'a';
SELECT LAST_INSERT_ID();  # retourne  1

Normal. Je recommence

INSERT INTO `testinsertId` v Values 'b';
SELECT LAST_INSERT_ID();  # retourne  2

Ca roule. maintenant 2 à la fois.

INSERT INTO `testinsertId` (i, v) Values ('','c'), ('','d');
SELECT LAST_INSERT_ID();  # retourne  3 !!!!!!

Ouch SELECT * FROM `testinsertId`;
+===+===+
| i | v | 
+===+===+
| 1 | a | 
+---+---+
| 2 | b | 
+---+---+
| 3 | c | 
+---+---+
| 4 | d | 
+---+---+
Et oui le last_insert_id retourne l'id du premier inséré. Ce n'est pas un bug (cfr commentaire de Darien) Mais j'ai quand même envie de savoir qu'est-ce qui a motivé ce choix.