angerbeaver Posted February 12, 2008 Share Posted February 12, 2008 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, Quote Link to comment https://forums.phpfreaks.com/topic/90740-_session-vs-database-calls/ Share on other sites More sharing options...
revraz Posted February 12, 2008 Share Posted February 12, 2008 Sounds like you answered your own question there. 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, Quote Link to comment https://forums.phpfreaks.com/topic/90740-_session-vs-database-calls/#findComment-465098 Share on other sites More sharing options...
haku Posted February 12, 2008 Share Posted February 12, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/90740-_session-vs-database-calls/#findComment-465111 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.