Jump to content

Recommended Posts

Hi,

 

I am making a small page for "customers". I have a table holding all the customer info. Obviously when the customer logs in I put their ID in a SESSION variable.

 

Now to access customer details (first name, last name, address etc etc), is it better to keep connecting to database and making calls or carry over all the info in SESSION variables (maybe even a bunch of hidden fields?)?

 

I would think there is quite a bit of over-head with all the potential database connections/requests etc but I'm not sure how much a SESSION variable can bog down a page (or how much a bunch of hidden fields would bog it down).

 

Think about the table having around 700,000 records, and if I use SESSION variables/hidden fields there would be around 10 or 15

 

Thanks,

Link to comment
https://forums.phpfreaks.com/topic/90740-_session-vs-database-calls/
Share on other sites

I believe (and I'm not 100% sure, but I'm like 90% sure) that all your cookies and all your session data are sent to the server each time you refresh a page. That's the only way that the server can know what is stored in your variables. So the more session variables you have, the slower your page requests are going to become. Databases are made to be searched, and so they will do it very fast.

 

There is going to be a difference but as to which is faster, I couldn't say.

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.