// Retrieve all records into an indexed array of stdClass objects. $result->fetchAll(); // Retrieve all records into an associative array keyed by the field in the result specified. $result->fetchAllAssoc($field); // Retrieve a 2-column result set as an associative array of field 1 => field 2. $result->fetchAllKeyed(); // You can also specify which two fields to use by specifying the column numbers for each field $result->fetchAllKeyed(0,2); // would be field 0 => field 2 $result->fetchAllKeyed(1,0); // would be field 1 => field 0 // If you need an array where keys and values contain the same field (e.g. for creating a 'checkboxes' form element), the following is a perfectly valid method: $result->fetchAllKeyed(0,0); // would be field 0 => field 0, e.g. [article] => [article] // Retrieve a 1-column result set as one single array. $result->fetchCol(); // Column number can be specified otherwise defaults to first column $result->fetchCol($column_index); $query = db_select('node', 'n') ->condition('type', 'article') ->fields('n'); $query = $query->extend('PagerDefault')->limit(2); $result = $query->execute(); while($record = $result->fetchAssoc()) { print_r($record); } $output .= theme('pager', array('tags' => array()));