From 27cfca44b3c43c8bbd3ea5ac602e1f34753e1e90 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 5 Feb 2017 02:33:55 -0500 Subject: Fix bug in mysql query function Need to remove the NULL return value from fetch_assoc() to fix usages of count($res) for determining the number of results from a MySQL query. This NULL return value is returned from mysqli's fetch_assoc() function to signal no more result rows. --- app/class/mysql.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/class') diff --git a/app/class/mysql.class.php b/app/class/mysql.class.php index fae09bb..db0eb7d 100644 --- a/app/class/mysql.class.php +++ b/app/class/mysql.class.php @@ -53,7 +53,7 @@ class mysql extends database return $arr; while (($arr[] = $res->fetch_assoc())); - return $arr; + return array_filter($arr, function ($val) { return !is_null($val); }); } /* -- cgit v1.2.3