CodeIgniter Forums

Full Version: Unserialize ci_sessions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum


I need your help Smile
I would like to display all online members
thanks to ci_sessions database.

So, in my controller i write :

function get_users_online()
        return $this->unite_model->get_users_online_model();    

In my model, the request :

function get_users_online_model()
        $data = array();
        $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 :

<?php foreach($users_online as $user_online): ?>
           &lt;?php echo ($user_online->user_data); ?&gt;
     &lt;?php endforeach; ?&gt;

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 Smile

Thank you a lot Smile