[eluser]Jondolar[/eluser]
Why are you calling $query->num_rows();
You are using an ActiveRecord call that returns an array. You have no object to call num_rows() against.
If you want to continue to use ActiveRecord you need to call:
$this->db->count_all('my_table');
Basically, you are mixing ActiveRecord functions with the database class functions