From 9d4fa2963b1059fed54aaeae583bf02a30c42239 Mon Sep 17 00:00:00 2001 From: jhunkeler Date: Mon, 4 Jan 2010 04:54:14 +0000 Subject: Fixed SVN maybe. git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@448 c5b2fb0a-d05d-0410-98c8-828840a80ff6 --- includes/sql.class.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'includes/sql.class.php') diff --git a/includes/sql.class.php b/includes/sql.class.php index 2bdb996..bbc0bbb 100644 --- a/includes/sql.class.php +++ b/includes/sql.class.php @@ -88,20 +88,26 @@ class Bayonet_SQL return is_array($result) ? $result : array(); } - public function FetchObject($p_result, $class) + public function FetchObject($p_result, $class, $no_array = false) { global $db_fetches; ++$db_fetches; decho("Fetching object result"); - while ($row = mysqli_fetch_object($p_result, $class)) { - (object)$result[] = $row; + while ($row = mysqli_fetch_object($p_result, $class)) + { + if($no_array == true) + (object)$result = $row; + else + (object)$result[] = $row; } $this->Free($p_result); - return is_object($result) ? $result : (object)array(); + // TODO: Test for objects inside of $result array + if($no_array == true) { return is_object($result) ? $result : (object)$nothing; } + return is_array($result) ? $result : (object)array(); } public function FetchAssoc($result) -- cgit