How to get all rows from a database table?
DatabaseStatementBase::fetchAssoc fetches the next row and returns it as an associative array.

$query = db_select('voting_nomination_counter', 'v');
$query-&gt;fields('v',array('uid'));
$result = $query-&gt;execute();
while($record = $result-&gt;fetchAssoc()) {
  print_r($record);
}