From f4df8ab602cd8d9d2ead55999f312b2da6eea1e0 Mon Sep 17 00:00:00 2001 From: marcus Date: Tue, 29 Jul 2008 16:39:30 +0000 Subject: Fixed count git-svn-id: https://code.elgg.org/elgg/trunk@1578 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/system_log.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'engine/lib/system_log.php') diff --git a/engine/lib/system_log.php b/engine/lib/system_log.php index 83a7406aa..458c9da93 100644 --- a/engine/lib/system_log.php +++ b/engine/lib/system_log.php @@ -90,15 +90,26 @@ $where[] = "object_class='$class'"; $select = "*"; - if ($count) $select = "count(*)"; + if ($count) $select = "count(*) as count"; $query = "SELECT $select from {$CONFIG->dbprefix}system_log where 1 "; foreach ($where as $w) $query .= " and $w"; - $query .= " order by time_created desc"; - if (!$count) $query .= " limit $offset, $limit"; // Add order and limit - - return get_data($query); + if (!$count) + { + $query .= " order by time_created desc"; + $query .= " limit $offset, $limit"; // Add order and limit + } + + if ($count) + { + if ($numrows = get_data_row($query)) + return $numrows->count; + } + else + return get_data($query); + + return false; } /** -- cgit v1.2.3