DatabaseStatementInterface::fetchAllKeyed

public function DatabaseStatementInterface::fetchAllKeyed

public DatabaseStatementInterface::fetchAllKeyed($key_index = 0, $value_index = 1)

Returns the entire result set as a single associative array.

This method is only useful for two-column result sets. It will return an associative array where the key is one column from the result set and the value is another field. In most cases, the default of the first two columns is appropriate.

Note that this method will run the result set to the end.

Parameters

$key_index: The numeric index of the field to use as the array key.

$value_index: The numeric index of the field to use as the array value.

Return value

An associative array, or an empty array if there is no result set.

File

includes/database/database.inc, line 2137
Core systems for the database layer.

Class

DatabaseStatementInterface
Represents a prepared statement.

Code

public function fetchAllKeyed($key_index = 0, $value_index = 1);

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!database!database.inc/function/DatabaseStatementInterface::fetchAllKeyed/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部