function DatabaseStatementBase::fetchAllKeyed

File

includes/database/database.inc, line 2321

Class

DatabaseStatementBase
Default implementation of DatabaseStatementInterface.

Code

public function fetchAllKeyed($key_index = 0, $value_index = 1) {
  $return = array();
  $this->setFetchMode(PDO::FETCH_NUM);
  foreach ($this as $record) {
    $return[$record[$key_index]] = $record[$value_index];
  }
  return $return;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.