This is what is did that solved the same problem. I solved it by creating a function that returns the query result thus:
function getUsers(){
$query = $this->db->get('users');
return $query->result();
}
//The above code can go in the user_model or whatever your model is.
This allows me to use one function for the result and number of returned rows.
Use this code below in your contoller where you need the count as well as the result array().
//This gives you the user count using the count function which returns and integer of the exact rows returned from the query.
$this->data['user_count'] = count($this->user_model->getUsers());
//This gives you the returned result array.
$this->data['users'] = $this->user_model->getUsers();
I hope this helps.