Fix error undefined variable query on count_all_results db active record
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index 71762a4..4247351 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -1127,15 +1127,14 @@
 		$result = $this->query($this->_compile_select($this->_count_string.$this->_protect_identifiers('numrows')));
 		$this->_reset_select();
 
-		if ($query->num_rows() === 0)
+		if ($result->num_rows() === 0)
 		{
 			return 0;
 		}
 
-		$row = $query->row();
+		$row = $result->row();
 		return (int) $row->numrows;
 	}
-
 	// --------------------------------------------------------------------
 
 	/**