How to loop over fields from query?
$result = $query-&gt;execute()-&gt;fetchAll();


should do the trick.

There's a lot more info and several more examples in http://api.drupal.org/api/examples/dbtng_example!dbtng_example.module/7