Jump to content
Larry Ullman's Book Forums

Where/How To Store Site Data?


Recommended Posts

For a site I'm working on, there is a fair amount of data central to the functioning of the site. This data is mainly data that goes into a number of select boxes, check boxes, radio buttons, etc. Essentially, everyone who goes to the site needs access to this data at almost all times to properly view the site. Also, the data could potentially be updated at any time, so I need to be able to check whether the data has been updated each time a new page is loaded.

 

With all that said, what's the best way to store all this site data?

 

I was originally thinking about putting the data in separate DB tables based on type, but that'd probably result in 10-15 different tables, each one not containing too, too much data. The problem with this is that all those tables would have to be checked every time a page is loaded, which seems a bit crazy. Maybe there's an easy way to do this (e.g., checking last-updated timestamps), but I don't know.

 

An alternative would be to perhaps put all the site data in one table (even though the data is of different types), and then add a type column to the table to differentiate the different types of data. This seems like it would be quicker (obviously) because it would all in be one table, but of course, this wouldn't be as normalized as my first suggestion.

 

As an alternative to DB tables, I could also use a flat text file to store the data and/or store all the data on the PHP side in arrays, but I'm not sure if either of these is the best option.

 

Long story short (too late, right?!), I'm not sure of the best route to take. I know everything is rather vague in this post, but if anyone has any previous experience with similar situations, please share what you found to be the best approach.

 

Thank you very much.

Link to comment
Share on other sites

You helped me some time ago by something similar for car makes and models. I solved this by saving the data as JSON, but it could obviously be generating executable PHP arrays to.

 

My solution was to save the info in a database, then write to this file on updates/inserts. I would think something similar could work for you as well.

 

I'll think about it some more if not, but I don't really think I would find a better solution.

Link to comment
Share on other sites

 Share

×
×
  • Create New...