I currently have a separate database for every competition year and I know I can combine the majority of the tables between databases by simply adding a year field. However, in each database there are 2 tables that can vary dramatically from year to year: matches and stats.
In the match table, the number of team fields can vary from 4-6, scoring fields from 1-4 and other fields depending on how scoring data is tabulated. And in the statistics table, the same scoring data is tabulated on a per team basis to allow for event rankings.
I guess my question is would it be better for me to combine, storing the varying data fields as one in a serialized array and use PHP’s array_multisort() to get the data in order, or leave it as is, or do something else?
Combining the tables is the logical choice, given you don’t have an enormously large amount of records (as AndreKR said). Sorting using
array_multisort()works like a charm. Just keep in mind if you aren’t sorting on the same fields every time, you’ll want to call the function usingcall_user_func_array()which can be a little tricky if you haven’t used it before. I had to do this to achieve the intended order of display for my data.