I am developing an application and I came across a situation where I would like to take a snapshot of current data.
For example, in this application, users will have different statistics and will be able to enter matches. How they are placed in matches depends on their statistics. When matches are determined, the application will pull out all the current statistics of the user and determine their points to find out who wins.
Now, after the end of the match, I want users to be able to view past matches, and the problem occurs when I want to show what the participants indicate during the match. I would think it would be acceptable to store an array structured like this:
array( array(username, points), array(username, points), etc. )
Data normalization may now be best practice, but in this situation:
- There can be a place in a match between 2 and 25 participants.
- Data will never be updated, only read.
- I would have thought that having it in an array structure in a database would save me from having to create an array in my internal code.
- EDIT: Data is not persistent. Match records will be deleted 7 days after the end of the match.
Can someone tell me if this solution will give any problems?
EDIT
I would save the data after serializing the array, so in my database I would have a table called "matches" and it would have a column called "results".
Rows for this column will contain serialized arrays. So, if the array looked like that:
$array["a"] = "Foo"; $array["b"] = "Bar"; $array["c"] = "Baz"; $array["d"] = "Wom";
Then the row in the database will look like this:
a:4:{s:1:"a";s:3:"Foo";s:1:"b";s:3:"Bar";s:1:"c";s:3:"Baz";s:1:"d";s:3:"Wom";}