Sorry if the title is unclear. Basically I have a query that inserts multiple rows like this:
//Build Query
$querySQL = ('
INSERT INTO myTable (col1, col2)
VALUES (val1, val2), (val1, val2);
');
//Run query
$db->query($querySQL);
//Get the last inserted id
$last_id = $db->insert_id;
echo $last_id;
When I run this query, I will insert two rows into the "myTable" table. Let's say the id's are k and k+1. You would expect that the code would print k+1 but it doesn't! It prints k.
How come? And how safe is it to assume that the return value of insert_id will always be the first row inserted when inserting in this way?
Thanks!