El Forum
01-02-2012, 04:11 PM
[eluser]Omaplie[/eluser]
Hi,
I need your help
I would like to display all online members
thanks to ci_sessions database.
So, in my controller i write :
In my model, the request :
And in my view :
And this code display me this :
I just would like to display :
I think that, it's necessary to unserialize but that doesn't work.
Please help me
Thank you a lot
Hi,
I need your help

I would like to display all online members
thanks to ci_sessions database.
So, in my controller i write :
Code:
function get_users_online()
{
return $this->unite_model->get_users_online_model();
}
In my model, the request :
Code:
function get_users_online_model()
{
$data = array();
$this->db->select('*');
$this->db->from('ci_sessions');
$this->db->where('user_data !=', '');
$this->db->like('user_data', 'prenom_membre');
$query = $this->db->get();
foreach($query -> result() as $row){
$data[] = $row;
}
return $data;
}
And in my view :
Code:
<?php foreach($users_online as $user_online): ?>
<li>
<?php echo ($user_online->user_data); ?>
</li>
<?php endforeach; ?>
And this code display me this :
Quote:a:5:{s:5:"login";s:22:"[email protected]";s:8:"id_unite";s:1:"1";s:10:"nom_membre";s:7:"Piu";s:13:"prenom_membre";s:4:"Piu";s:6:"logged";b:1;}
a:5:{s:5:"login";s:22:"[email protected]";s:8:"id_unite";s:1:"3";s:10:"nom_membre";s:7:"Tampone";s:13:"prenom_membre";s:4:"John";s:6:"logged";b:1;}
I just would like to display :
Quote:- Piu Piu
- John Tampone
I think that, it's necessary to unserialize but that doesn't work.
Please help me

Thank you a lot
