October 2, 201213 yr Hey, havent touched PHP in a good 6 months and even then i spent a couple of weeks with it. I created a simple login / out with profile page and decided to play around with it today. I want to show the username of the logged in user on the profile page but when using: echo($_SESSION['username']); it shows my database username... Any help?
October 2, 201213 yr Hey, havent touched PHP in a good 6 months and even then i spent a couple of weeks with it. I created a simple login / out with profile page and decided to play around with it today. I want to show the username of the logged in user on the profile page but when using: echo($_SESSION['username']); it shows my database username... Any help? mmm more then likely your storing your database username in the session $_SESSION['username'] when creating the session. and im not sure i know what you mean by logged in username and database username should they not be the same?
October 2, 201213 yr when you are logging the user in , store the username in it like : $_SESSION['user_name']=$username; when you say it shows my database username... I'm assuming you have an admin area too,but it shows your username instead of users . if this is the case ,try to save the users username in different session,this will solve your problem.
Create an account or sign in to comment