Welcome Guest, Not a member yet? Register   Sign In
count_all_results() returns 1 for an empty table if called after get().
#1

[eluser]Mark Skilbeck[/eluser]
I noticed this today and was quite annoyed because it meant editing 90% of all my models and 90% of all their methods.

If I have an empty table, and do the below:

Code:
$this->db
     ->from('projects');
$query = $this->db->get();
die ( $this->db->count_all_results() );

The output is 1, even if the table is empty.

However, if I move the get() call to after the count_all_results() call, it returns the correct number of rows.

Why is this?




Theme © iAndrew 2016 - Forum software by © MyBB