Storing information php/mysql
I have a php/mysql setup. My question is simple and I believe I already have the answer. I have different users who logon to this php site, and modify settings for each user. For example I login with user, and change the time to 9开发者_JAVA技巧pm. When I log off and log back in the time is set to blank again, I am using sessions by the way. In order to have the set value every time I login I would have to store the value in the mysql database in order to retrieve it every time I login correct?
Or is there another way I can do this?
Thanks,
Yes, correct. Information in sessions is gone once the session is destroyed (user logged out).
To store information persistently, use a database.
You could also write it to a file for the same effect, but I'd recommend the database approach.
Right. PHP doesn't have global app level, after session are file or DB.
A file implement here. Just in case.
精彩评论