Welcome Guest, Not a member yet? Register   Sign In
Session with DB question (updated 11:15 CST)
#1

[eluser]R_Nelson[/eluser]
I am using sessions with the DB option what i would like to do is extend it so that it can be used to see what users are logged in.

Code:
$this->db->like('user_data','username');
$this->db->order_by('last_activity','desc');    
$data['query'] = $this->db->get('ci_sessions');

and when i log in the user_data looks like this
Code:
a:5:{s:8:"username";s:8:"britblad";s:2:"id";s:1:"1";s:4:"name";s:13:"Rodney Nelson";s:10:"user_level";s:2:"10";s:12:"is_logged_in";b:1;}

how do i display the info from this i want the username and the id to be useable i have a loop to display just not shure what to put in the loop it looks like this now
Code:
<?php foreach($query->result() as $row ): ?>
        
<?php endforeach; ?>
#2

[eluser]WanWizard[/eluser]
userdata is a serialized array, to convert it back to an array use unserialize().
#3

[eluser]R_Nelson[/eluser]
ok thx that fixes that problem




Theme © iAndrew 2016 - Forum software by © MyBB