I have a table called user in my database.
I have a column name called isLogged
on my user
row.
And when the user islogged
on it changes to '1'
. And logged out changes to '0'
.
What is the best way to count the users that have '1'
in the isLogged column.
model
public function getTotalUserOnline() {
// Only Counts Number Of Users
$query = $this->db->count_all('user');
return $query;
}
and then echo it from controller.
$data['total_user_online'] = $this->dashboard_user_online_model->getTotalUserOnline();