I noticed that if I prepare a multi-insert statement and execute it into MySQL via PDO, and then request the last_insert_id, I get the first ID of the multiple inserted rows, not the last one. Specifically:
"INSERT INTO test_table (value1, value2, value3) VALUES (1, 2, 3), (1, 2, 3)";
will create these rows on an empty table:
ID value1 value2 value3
1 1 2 3
2 1 2 3
But the last_insert_id will return "1". Is this a known issue or am I doing something wrong? Could someone verify/test/explain this? I am at a loss at what to do to get the proper last ID, save for doing an actual select which would be WAY slower.