Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/lib/pkgbasefuncs.inc.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php index 3bb07e5..91db229 100644 --- a/web/lib/pkgbasefuncs.inc.php +++ b/web/lib/pkgbasefuncs.inc.php @@ -9,17 +9,16 @@ include_once("config.inc.php"); * @return array All package categories */ function pkgbase_categories() { - $cats = array(); $dbh = DB::connect(); $q = "SELECT * FROM PackageCategories WHERE ID != 1 "; $q.= "ORDER BY Category ASC"; $result = $dbh->query($q); - if ($result) { - while ($row = $result->fetch(PDO::FETCH_NUM)) { - $cats[$row[0]] = $row[1]; - } + if (!$result) { + return null; } - return $cats; + + return array_combine($result->fetchAll(PDO::FETCH_COLUMN, 0), + $result->fetchAll(PDO::FETCH_COLUMN, 1)); } /** -- 1.9.1