Storing data for the last five days

Hi there,

I’m looking to build a database which will integrate with something like FusionCharts. Therefore, I’ll be storing data over a weekly period to display in the relevant graph.

However, I’ve got a couple of questions about the best way to set this up:

  • How should the fields be labelled in the database? Just something generic like ‘Day 1’ through to ‘Day 7’?
  • How do I ensure that the PHP script enters the right value in the right field? Is there some way of saying in PHP insert the value into ‘the next available field?’
  • And equally what would you recommend I do at the end of each week? Just overwrite the data? Or store it in a separate table somewhere?

Thanks a lot in advance,

a column for each day will give you more problems than you want

enter each day’s data into its own row, with the date as part of the key

Ah ok - so therefore if I was tracking the value of stocks for example, would the best option to be to have the date entered into each row as you suggest with the each company name having its own separate column?

Thanks a lot for your help!

no :slight_smile:

company would be part of the key as well