Jump to content

[SOLVED] Using Session To Store Data


jaymc

Recommended Posts

I am thinking of using session to hold 8 pieces of information

 

For instance, when a user clicks on a whosonline list maybe they like to to be displayed Z-A by default

 

Normally you would save this data in a database.. which I will

 

However, I dont want to have to query the database everytime I need to find out if they want something displayed to there Z-A preference

 

So, upon login I was thinking of querying the database and then storing everything I need in SESSIONS

 

Is this the norm or are there better ways to do this. If it is the norm, can you think of any reason why this would be a bad idea..

 

Cheers

Link to comment
https://forums.phpfreaks.com/topic/73633-solved-using-session-to-store-data/
Share on other sites

It's a perfectly fine idea - Though, this data will only be stored for the length of the session - If you want this data to still be available next time they visit without querying the database, it might be worth looking into cookies. Though the load on the database you will be causing will be next to nothing anyway, with regards to the session method.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.