title: Count total items inserted from array into mysql db
body: <p>I have a an array of urls that fetch some data which gets inserted into a db. I'm using php and pdo. I need to see how many were inserted from the entire array once it has completed, currently I have:</p>
  
  <pre><code>(array(
  'http://www.example.com/1',
  'http://www.example.com/2',
  'http://www.example.com/3'))
  
  foreach ($line-&gt;get_items() as $item){
  pdo insert here...
  $count = $q-&gt;rowCount();
  print("Added $count Items.\n");
  }
  </code></pre>
  
  <p>As expected this is returning the count for each time it is inserted, so I might get:
      Added 1 Items Added 1 Items Added 1 Items</p>
  
  <p>How can I aggregate all the inserts together to see how many in total were inserted?</p>