How to iterate through an object returned by fetchAll?
&lt;?php
// Retrieve all records into an indexed array of stdClass objects.
$info = $result-&gt;fetchAll();

// Retrieve all records into an associative array
// keyed by the field in the result specified.
$info = $result-&gt;fetchAllAssoc($field)


To iterate just use:

foreach($info as $key =&gt; $object) {
  print $object-&gt;property . "&lt;br&gt;";
}


References:

https://www.drupal.org/node/1251174