From 7684def0f8feb29e17077dbfd871579ee1a2a073 Mon Sep 17 00:00:00 2001 From: Shish Date: Sat, 1 Jan 2011 16:27:56 +0000 Subject: [PATCH] add get_pairs --- core/database.class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 */