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

[eluser]daparky[/eluser]
From what i gather, num_rows is how many rows are in a table no matter what query you are performing and count_all_results returns the number of rows in a query with other db queries such as like and where.

Do something like this:-

Code:
$this->db->get('widgets');
$count = $this->db->count_all_results();

Or

Code:
$this->db->like('name', $letter, 'after');
$this->db->from('clients');
$count = $this->db->count_all_results();

You will then use $count for the pagination. The only problem with this is that you are going to have to run the same query twice, one for the view and the other to count for the pagination.


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