EllisLab text mark
Advanced Search
     
Doubt using session
Posted: 31 August 2007 10:01 AM   [ Ignore ]
Joined: 2007-08-16
4 posts

Hi friends, forgives my bad English…

I am with a doubt using sessions, already I searched in forum and I did not find the solution.

The doubt is the following one:

I possess an Array of the following collection:

$arr = Array('idclient' => $idClient'name' => $nameClient); 

necessary to insert this Array in one session:

$this->session->set_userdata('client'$arr); 

The doubt is following now:
How I go to have access the value ‘name’ for example? Using

$this->session->userdata('name'); 

it returns emptiness.

Tips?

hug.  cheese

 
Posted: 31 August 2007 10:08 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2006-07-14
4237 posts

you set the session key to retrieve that array as client so

$this->session->userdata('client'); 

gets the array. If you want to extract name you have to do

$client $this->session->userdata('client');
echo 
$client['name']
 
Posted: 31 August 2007 10:14 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2007-08-16
4 posts

simple and efficient! thanks!  cheese