[eluser]cahva[/eluser]
First. In your example you use username and password in the session. Instead, save the user_id in the session. If you have user_id in the session, the code would be something like this:
Model:
Code:
...
function info()
{
if (!$this->session->userdata('logged_in_id'))
{
return FALSE;
}
$query = $this->db->get_where('users',array('user_id' => $this->session->userdata('logged_in_id')),1);
if ($query->num_rows() > 0)
{
return $query->row();
}
else
{
return FALSE;
}
}
Controller:
Code:
...
$this->load->model('user');
$data['user'] = $this->user->info();
$this->load->view('userinfo',$data);
}
Now in the view you can use $user->username, $user->email etc.
I left out checks that you ofcourse have to do that user_id is in session etc.