diff --git a/core/database.class.php b/core/database.class.php index a02132d8..0d4e3927 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -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 */