You can do this in two different ways:
1. $this->db->query(); //execute the query
$query = $this->db->get() // get query result
$count = $query->num_rows() //get current query record.
2. $this->db->query(); //execute the query
$query = $this->db->get() // get query result
$count = count($query->results())
or count($query->row_array()) //get current query record.