How to get all rows from a database table? I have the table where I store uid column. I want to get all the values from that table, but I only get the frist element.

My query:

$sql = db_select('voting_nomination_counter', 'v')
-&gt;fields('v', array('uid'))
-&gt;execute()
-&gt;fetchAssoc();


Where is my problem?
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);
}