Running the following query using PDO (Actually, I use prepared statements but same problem)

INSERT INTO MyTable(MyField) VALUES('Row1'), ('Row2')

How can I get the Ids for the records relating to Row1 and Row2?

$db->lastInsertId() literally returns the last single Id.

Is it sufficient to take this last Id, subtract the # of records and assume that range covers all my records? can there be gaps/jumps. Is this query guaranteed to be atomic?

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top