melting_dog Posted November 1, 2011 Share Posted November 1, 2011 Hi guys, I am trying to retrieve some information from sessions. I have this in my header.php <?php if(isset($_SESSION['username'])){ $username = $_SESSION['username']; echo $username; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/250228-getting-root-from-session-varialbes/ Share on other sites More sharing options...
trq Posted November 1, 2011 Share Posted November 1, 2011 And the problem is? Quote Link to comment https://forums.phpfreaks.com/topic/250228-getting-root-from-session-varialbes/#findComment-1283933 Share on other sites More sharing options...
melting_dog Posted November 1, 2011 Author Share Posted November 1, 2011 Sorry guys, I just posted this before but must have hit send in its incompleted state. What I meant to say is: Hi guys, I am trying to retrieve some information from sessions. I have this in my header.php <?php if(isset($_SESSION['username'])){ $username = $_SESSION['username']; echo $username; } ?> And it works fine - $username returns and prints the correct string. But when I try the same echo on another file (that includes() header.php) I just get the word 'root' - not the actual user name Can anyone help me with this? Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/250228-getting-root-from-session-varialbes/#findComment-1283935 Share on other sites More sharing options...
trq Posted November 1, 2011 Share Posted November 1, 2011 You sure your not overriding the $username variable somewhere along the line? Quote Link to comment https://forums.phpfreaks.com/topic/250228-getting-root-from-session-varialbes/#findComment-1283942 Share on other sites More sharing options...
melting_dog Posted November 3, 2011 Author Share Posted November 3, 2011 Hi Thorpe - yes that seems to have been the problem! Cheers Quote Link to comment https://forums.phpfreaks.com/topic/250228-getting-root-from-session-varialbes/#findComment-1284606 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.