Jump to content

to session or to query


jonniejoejonson

Recommended Posts

I understand when you CAN use a session, but when would you better to session than to query...

for example - on facebook, if you view my profile page and view my images page, both pages have my name in the heading...

Do they query the database to get my name every time, or do they simply session my name?.. and then if the user changes they destroy the name session and create a new one?

thanks to any responders.

Link to comment
https://forums.phpfreaks.com/topic/129949-to-session-or-to-query/
Share on other sites

It's better to use Query when you are dealing with a value that can change often, that way you don't have to destroy the session every time someone changes the value.

 

Likewise, it's best that you use sessions for something that rarely changes, to reduce server load...

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.