Answer by Mitchell McKenna for CodeIgniter ActiveRecord problems
September 26 2010, 6:14am
Where you are using count_all_results(), I think you mean to use num_rows(). count_all_results() will actually create a SELECT COUNT(*) query.
For debugging your problems... If you want to test if an insert() worked, use affected_rows(), example:
var_dump($this->db->affected_rows());
At any point you can output what the last query with last_query(), example:
var_dump($this->db->last_query());
You can also turn on the Profiler so you can see all the queries being run, by adding in the controller:
$this->output->enable_profiler(TRUE);
http://stackoverflow.com/questions/3796602/codeigniter-activerecord-problems/3797351#3797351