Welcome Guest, Not a member yet? Register   Sign In
Unserialize ci_sessions
#1

[eluser]Omaplie[/eluser]
Hi,

I need your help Smile
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>
           &lt;?php echo ($user_online->user_data); ?&gt;
       </li>
     &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




Theme © iAndrew 2016 - Forum software by © MyBB