Welcome Guest, Not a member yet? Register   Sign In
Can someone help me understand count_all_results?
#1

[eluser]Unknown[/eluser]
So, what exactly does count_all_results return? I was doing a test to try and nail it down, and I'm stumped.

I have a table called "widgets" that has 2 rows in it.

If I do this:
Code:
$this->db->cache_off();   // Just in case.
$query = $this->db->get('widgets');
print($this->db->count_all_results());
print($query->num_rows());
print_r($query->result());

...I get that count_all_results() returns "1", but num_rows() returns "2" and result() returns two objects.

What exactly is count_all_results() returning, here? Why is it one and not two?

The reason I ask is that I'm trying to paginate a search of widgets, and it seems like count_all_results() should return the value that I want to drop into the paginate class for total records, but it doesn't seem to be doing that.


Messages In This Thread
Can someone help me understand count_all_results? - by El Forum - 09-22-2009, 10:59 AM
Can someone help me understand count_all_results? - by El Forum - 09-22-2009, 12:40 PM
Can someone help me understand count_all_results? - by El Forum - 09-22-2009, 12:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB