diff --git a/lib/dmllib.php b/lib/dmllib.php index 3304ad020e062..e2f6b3c05d7df 100644 --- a/lib/dmllib.php +++ b/lib/dmllib.php @@ -371,7 +371,7 @@ function count_records_select($table, $select='', $countitem='COUNT(*)') { function count_records_sql($sql) { $rs = get_recordset_sql($sql); - if ($rs) { + if (is_object($rs) and is_array($rs->fields)) { return reset($rs->fields); } else { return 0;