CodeIgniter Forums
Unserialize ci_sessions - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Libraries & Helpers (
+--- Thread: Unserialize ci_sessions (/thread-48039.html)

Unserialize ci_sessions - El Forum - 01-02-2012


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