allex01 Posted February 20, 2008 Share Posted February 20, 2008 How can i retrieve the password value from this session array. I tried something like $_SESSION['fc_users_cache']['password'] but can't seem to get it. Any help would be greatly appreciated. I simply did a print_r($_SESSION); to get the following Array ( [user] => Array ( [user_id] => 1 [user_name] => webmaster [time_zone] => 0 ) => [admin] => Array ( [is_logged_in] => 1 ) [pstart] => 0 [vstart] => 0 [astart] => 0 [mstart] => 0 [fstart] => 0 [fc_users_cache] => Array ( [1] => Array ( [user_id] => 1 [user_name] => admin [password] => adminpass => admin@admin.com [referrer_id] => 0 [first_name] => admin [last_name] => admin ) ) Quote Link to comment Share on other sites More sharing options...
mainewoods Posted February 20, 2008 Share Posted February 20, 2008 $_SESSION['fc_users_cache'][1]['password'] --you need that '[1]' in there Quote Link to comment Share on other sites More sharing options...
allex01 Posted February 20, 2008 Author Share Posted February 20, 2008 Yes i tried that and it didn't work. I can easily get the user_name by doing $_SESSION['user']['user_name'] but i'm not able to get the password using the following I tried $_SESSION['fc_users_cache']['password'] or $_SESSION['fc_users_cache'][1]['password'] or $_SESSION['fc_users_cache']['1']['password'] Quote Link to comment Share on other sites More sharing options...
allex01 Posted February 20, 2008 Author Share Posted February 20, 2008 Anyone?? Quote Link to comment Share on other sites More sharing options...
cowfish Posted February 20, 2008 Share Posted February 20, 2008 deleted post. Quote Link to comment Share on other sites More sharing options...
allex01 Posted February 20, 2008 Author Share Posted February 20, 2008 It's a typo and has nothing to do with the questions above. Even if it was typo it's irrelavent. Quote Link to comment Share on other sites More sharing options...
cowfish Posted February 20, 2008 Share Posted February 20, 2008 Yeah you're right it's not relevant. Quote Link to comment Share on other sites More sharing options...
cowfish Posted February 20, 2008 Share Posted February 20, 2008 I rebuilt your array and tested it. It seems like it is working :-\ You can test the following code if you like. Did you forget to put in an echo before $_SESSION['fc_users_cache']['password'] ? I'm asking that because I do it quite often <?php $myArray = array ( "user" => array ( "user_id" => 1, "user_name" => "webmaster", "time_zone" => 0, ), "url" =>NULL, "admin" => array("is_logged_in" => 1), "pstart" => 0, "vstart" => 0, "astart" => 0, "mstart" => 0, "fastart" => 0, "fc_users_cache" => array ( 1 => array ( "user_id" => 1, "user_name" => "admin", "password" => "adminpass", "email" => "admin@admin.com", "referrer_id" => 0, "first_name" => "admin", "last_name" => "admin", ) ) ); echo $myArray['fc_users_cache']['1']['password']; echo "<br />"; echo $myArray['fc_users_cache'][1]['password']; ?> Quote Link to comment Share on other sites More sharing options...
rameshfaj Posted February 20, 2008 Share Posted February 20, 2008 Can we know how did u first insert the data into session?The retrieval may vary in that manner too. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.