add a judgment of whether reset select
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 79cbfb3..894d7dd 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -1355,7 +1355,7 @@
 	 * @param	string
 	 * @return	int
 	 */
-	public function count_all_results($table = '')
+	public function count_all_results($table = '', $reset = true)
 	{
 		if ($table !== '')
 		{
@@ -1366,7 +1366,10 @@
 		$result = ($this->qb_distinct === TRUE)
 			? $this->query($this->_count_string.$this->protect_identifiers('numrows')."\nFROM (\n".$this->_compile_select()."\n) CI_count_all_results")
 			: $this->query($this->_compile_select($this->_count_string.$this->protect_identifiers('numrows')));
-		$this->_reset_select();
+        if($reset)
+        {
+		    $this->_reset_select();
+        }
 
 		if ($result->num_rows() === 0)
 		{