Connecting Tech Pros Worldwide Help | Site Map

access array element

Newbie
 
Join Date: Feb 2008
Posts: 20
#1: Jul 2 '08
hello i have a stupid question i need help with in the array
Expand|Select|Wrap|Line Numbers
  1. Array ( [SESSION] => object Object ( [session_test] => 5FZ0bc4ion [page_category] => courses [bullet_category] => [logincount] => 0 ) [USER] => stdClass Object ( [id] => 82 [auth] => email [confirmed] => 1 [policyagreed] => 1 [deleted] => 0 [gender] => f [username] => theoni [password] => 8d76acf438cccacdca337f652825f996 [paypal] => [idnumber] => [firstname] => fenia [lastname] => #$% [email] => __munged__ [emailstop] => 0 [dateofbirth] => 0 [degree] => [expertise] 
I need to echo the $SESSION[USER] but i don't know how. can you please help?
thank you
pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#2: Jul 3 '08

re: access array element


Heya, Theoni.

Which property of the User object do you want to output?

You'll need to do something like this (assuming what you put in your OP is a print_r() of $_SESSION):
Expand|Select|Wrap|Line Numbers
  1. echo $_SESSION['USER']->id;
  2.  
Newbie
 
Join Date: Feb 2008
Posts: 20
#3: Jul 3 '08

re: access array element


Quote:

Originally Posted by pbmods

Heya, Theoni.

Which property of the User object do you want to output?

You'll need to do something like this (assuming what you put in your OP is a print_r() of $_SESSION):

Expand|Select|Wrap|Line Numbers
  1. echo $_SESSION['USER']->id;
  2.  


Thank you very much pbmods, this does work!

kind regards
pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#4: Jul 4 '08

re: access array element


We aim to please.

Good luck with your project, and if you ever need anything, post back any time!
Reply