[eluser]Matalina[/eluser]
You want the number of rows? Because when you use group_by it will preform the aggraget function in this case count on each row it find.
If you did not use group_by you would get the answer you wanted (I understand this isn't what you wanted).
I'm assuming you want to get the count of all the different players in your database.
Instead of using group by do this:
Code:
SELECT DISTINCT player_id FROM planets
So the active record code to get what you want is:
Code:
$this->db->distinct()->select('player_id')->get('planets')->num_rows();
This will return the number of rows the query generated. count_all_results() will probably work as well.
You could use num_rows() instead of count_all_results() in your original query and probably get the answer you want.