diff options
author | Simon Rettberg | 2018-06-12 17:13:37 +0200 |
---|---|---|
committer | Simon Rettberg | 2018-06-12 17:13:37 +0200 |
commit | 6c7a5ff06159c6908a47f11adbe30e2349a5fd75 (patch) | |
tree | 0366c9dbebed8d452bf052fc8cccb0b190af4a37 /inc | |
parent | [inc/Dashboard] getter for currently defined sub menus (diff) | |
download | slx-admin-6c7a5ff06159c6908a47f11adbe30e2349a5fd75.tar.gz slx-admin-6c7a5ff06159c6908a47f11adbe30e2349a5fd75.tar.xz slx-admin-6c7a5ff06159c6908a47f11adbe30e2349a5fd75.zip |
[inc/Database] Method to return single-column queries as array
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 d5992795..3b2414b5 100644 --- a/inc/database.inc.php +++ b/inc/database.inc.php @@ -77,6 +77,19 @@ class Database } /** + * Fetch the first column of the query as a plain list-of-values array. + * + * @return array|bool List of values representing first column of query + */ + public static function queryColumnArray($query, $args = array(), $ignoreError = null) + { + $res = self::simpleQuery($query, $args, $ignoreError); + if ($res === false) + return false; + return $res->fetchAll(PDO::FETCH_COLUMN, 0); + } + + /** * Execute the given query and return the number of rows affected. * Mostly useful for UPDATEs or INSERTs * |