I am new to PHP so I was hoping someone could provide me with some direction. I am creating a statistics page for a customer of mine, I know how to retrieve the data I need but this is what I am not sure how to do. All of the stats for the current month are updated every X hours but the stats from the months prior do not change, any suggestions on how i should go about storing those so i dont have to query the database just to retrieve the results?? Any help would be appreciated, a simple link to an example would be greatly appreciated.
if you are talking about the previous month's stats you could write them out to an array in a file. it would probably be easier to just query the db, but if you are concerned about traffic this could be a good way to go
Sounds to me like you require to an archive or warehouse type of database for summary stats of previous months. Where stats are built and written to the database at the end of each significant period (month). These can then be retrieved when required rather than having to be assembled. The stats for the current month would need to be retrieved and assembled in the same way as you are at the moment.
Depending on the database platform the warehousing of the summary data could be automated by scheduled tasks within the database.