Reputation: 2699
I am developing a webapp for teachers which may have hundreds of users who may each create ten or so templates with ten or so sections with ten or so topics each of which will have a long and short version of a piece of text.
This would result in a multidimensional array like this:
[userID][templates][1][name] // template 1 name
[userID][templates][1][1][name] // template 1 section 1 name
[userID][templates][1][1][1][name] // template 1 section 1 topic 1 name
[userID][templates][1][1][1][1][short] // template 1 section 1 topic 1 option 1 short
[userID][templates][1][1][1][1][long] // template 1 section 1 topic 1 option 1 long
Where each number may vary (up to about 10). The 'name' elements just represent user-friendly names.
There may also be some other settings outside of the template element. Only text needs to be stored and retrieved. What is the easiest way to store and retrieve this data. Will I need to create thousands of mySQL tables (is that way too many? I have only ever used up to 5) or is there a more straightforward way?
Upvotes: 0
Views: 482
Reputation: 17013
Write it to a string that you can store:$string = serialize($array)
Read it back into an object/array $array = unserialize($string)
Upvotes: 3