database, sessions or includes?
Posted: Tue Jun 21, 2011 1:36 pm
I am fairly new to PHP, so I have a basic question. I am developing a website and need variables set once to be used over and over again on all pages. My question is what's the best way to do this? I've come up with three solutions on my own but would like another opinion with more experience. Here are my solutions so far:
1. Read the data from a MySQL database on each page.
2. Read data from MySQL on one page and use sessions to pass the data to all other pages.
3. Set variables in an include file and include it on each page.
Which would be faster to the client? Which would be more efficient as far as server load? Am I missing a better solution? Any help would be appreciated.
Thanks!
1. Read the data from a MySQL database on each page.
2. Read data from MySQL on one page and use sessions to pass the data to all other pages.
3. Set variables in an include file and include it on each page.
Which would be faster to the client? Which would be more efficient as far as server load? Am I missing a better solution? Any help would be appreciated.
Thanks!