Jump to content

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...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.