add get_pairs
This commit is contained in:
parent
07959b1fc8
commit
7684def0f8
1 changed files with 12 additions and 0 deletions
|
@ -359,6 +359,18 @@ class Database {
|
|||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute an SQL query and return the the first row => the second rown
|
||||
*/
|
||||
public function get_pairs($query, $args=array()) {
|
||||
$stmt = $this->execute($query, $args);
|
||||
$res = array();
|
||||
foreach($stmt as $row) {
|
||||
$res[$row[0]] = $row[1];
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute an SQL query and return a single value
|
||||
*/
|
||||
|
|
Reference in a new issue