Hey Path, welcome to the Bytes.
Quote:
Originally Posted by Path9898
My application runs a series of webpages (like a slideshow) using data out of a mySQL DB. The first page that loads runs a select statement and writes the results to a cookie. The cookie then provides the answers that the following pages need.
Currently the select provides 26 values that goes into the cookie. This number is set to grow by 30%. Through out the slideshow there are about 4 additional smaller selects that provide answers for individual more complex pages.
I am trying to find out if it is more efficient for the server for me to run 1 large select statement, writing 50 answers to the cookie or if I should run 5 smaller select statements through out the show, each deleting and then updating the cookie with the next 10 answers.
Each time you query a db you will significantly slow down your script, so having 5 queries will definitely make you run slower.
Quote:
The answers can be a 1 or 0 or a short sentence or the name of an image to display.
I do not encrypt the cookie. Is this worth doing? Does it create a lot of overhead?
How much data can a cookie reliable hold?
I'm sure there is a physical limit, but I'm sure I've never reached it. Encrypting might make your script run a little slower, the general rule is whether there is any private information stored there. If so you should encrypt, not because it is especially likely anyone will find it, but just for the safety of your visitors. I don't know if this was any help, but good luck with your coding.
Jared