diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/database.inc.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/inc/database.inc.php b/inc/database.inc.php index eddd4faf..3e8ee0f8 100644 --- a/inc/database.inc.php +++ b/inc/database.inc.php @@ -91,6 +91,19 @@ class Database } /** + * Fetch two columns as key => value list. + * + * @return array|bool Associative array, first column is key, second column is value + */ + public static function queryKeyValueList($query, $args = array(), $ignoreError = null) + { + $res = self::simpleQuery($query, $args, $ignoreError); + if ($res === false) + return false; + return $res->fetchAll(PDO::FETCH_KEY_PAIR); + } + + /** * Execute the given query and return the number of rows affected. * Mostly useful for UPDATEs or INSERTs * |