• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Doubt using session

#1
[eluser]xernobil[/eluser]
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:
Code:
$arr = Array('idclient' => $idClient, 'name' => $nameClient);

necessary to insert this Array in one session:
Code:
$this->session->set_userdata('client', $arr);

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

Code:
$this->session->userdata('name');
it returns emptiness.

Tips?

hug. :cheese:

#2
[eluser]xwero[/eluser]
you set the session key to retrieve that array as client so
Code:
$this->session->userdata('client');
gets the array. If you want to extract name you have to do
Code:
$client = $this->session->userdata('client');
echo $client['name'];

#3
[eluser]xernobil[/eluser]
simple and efficient! thanks! :cheese:


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.