Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to retrieve a particular session value in codeigniter?

I would set a session value in codeigniter

$sess_array = array(
'id' => $row->Login_Id,
'username' => $row->Login_Name,
'postid'=> $row->Fk_Post_Id,
 );
$CI->session->set_userdata('logged_in', $sess_array);

Then how to retrieve a particular (say - id) session value . I tried these

$createdby=$this->session->userdata('id');
$createdby=$this->session->userdata($logged_in['id']);

but fails.

like image 888
manuthalasseril Avatar asked Apr 15 '13 08:04

manuthalasseril


1 Answers

Use the array syntax for this. Like,

$this->session->userdata['logged_in']['id'];
like image 79
Jibran K Avatar answered Nov 13 '22 11:11

Jibran K