I'm quite new to programming in general, so I expect this question to have an easy solution. I searched for an answer before posting, but I'm not really sure what I'm looking for.
Basically, I have a database with the following structure:
Table: things
Column 1- ID
Column 2- Name
Column 3- Year
Column 4- Timestamps
I have a large collection of timestamps for many things of the format hh:mm:ss that I want to store in the 4th column of the things table. Each item in the table will have a varying number of timestamps associated with it, so I thought it would make sense to simply store them all in a single column separated by commas (hh:mm:ss,hh:mm:ss) rather than store each timestamp in its own column. From here, I hoped that using PHP I could select the name of a thing and recall its year and timestamps, separating each timestamp into its own variable.
Example:
Column 2- Thing20
Column 3- 1997
Column 4- 00:01:24,00:05:28,00:16:52
$name = "Thing20"
$year = 1997
$ts1 = "00:01:24"
$ts2 = "00:05:28"
$ts3 = "00:16:52"
Here are my questions...
- Is this a practical solution for my needs? I'm having trouble thinking of a better way to do this...
- How would I go about separating the timestamps (which are separated by commas in the database entry) and storing them as incremental variables? Rather, I suppose you would use an array instead of many variables.
Any help at all would be greatly appreciated. As I said above, I am a beginner so I'm very sorry if this is a trivial thing to ask!
Thank you!