title: Retrieve ID's after bulk insert
body: <p>I'm using MySQL 5.5 with PHP 5.4. I'm performing a bulk insert and need to capture all of the newly inserted ID's. This is my code:</p>
  
  <pre><code>$db-&gt;query("INSERT INTO commodity (analysis_id, commodity_description, a_units, 
  a_average_yield, a_average_price) SELECT $analysis_id, commodity_description, 
  a_units, a_average_yield, a_average_price FROM commodity WHERE analysis_id = 
  $import_analysis_id");
  </code></pre>
  
  <p>Is there a way to retrieve all of the new ID's of the inserted rows? Using <code>$db-&gt;insert_id</code> only returns a single ID. I would hate to have to use a PHP loop and execute several queries, but I will if I have to. Thanks!</p>