PHP session refresh!

413 Views Asked by At

See i have a created a script that logs in the user. And I also added settings tab so that the users can edit their settings! But when I tried it the data in the mysql table changed but the User Name and User Email that is displayed in the profile remain the same! And when I logged out and re-login the User Name changed! Can someone tell me why the User Name and Email does not change o that session!

Thanks in advance!

2

There are 2 best solutions below

0
KingCrunch On BEST ANSWER

I assume, that you display the username und email straight from the session. If you change something in the db, you have the redundant data in the session and you use the data from the session without further validation, you must change the values there also.

0
Alex Pliutau On

I advice you to use another way to show user name. Save in the session only User ID. User name you should get from DB. Don't forget about caching.