Inserting Multiple Rows into a Database Table with PDO and Retrieving IDs of Inserted Rows

It is possible to insert multiple rows into a database table with a single query using PDO, but you won’t be able to retrieve the IDs of all inserted rows with a single query.

If you need to insert multiple rows and retrieve the IDs of all inserted rows, you would need to perform multiple inserts, one for each row, and retrieve the ID for each inserted row.

Leave a Comment

Your email address will not be published. Required fields are marked *