Jump to content

Session Variables, More Or Less?


smerny

Recommended Posts

Is it better practice to store more session variables.... or would it be better practice to store less?For example, you could just store the user ID and then get other info from the database WHERE userid = $_SESSION['userid'] whenever you need more info.... or you could get more info into sessions at login and not have to access database often?

Link to comment
Share on other sites

I think it's probably negligible to store more than one thing. If it's reading one thing out the session file, it might as well read more than one thing, it still only has to open the file once. So, if you're going to have it use the session at all, might as well store everything you'll need from the database there. It depends on specific data I guess, it's not going to be great to store huge amounts of data in the session, it just depends what your application requires.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...