0

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?

1
  • obviously there is no point in each user loading the whole array as it contains settings for all the users Commented Feb 15, 2012 at 18:51

1 Answer 1

3

Write it to a string that you can store:$string = serialize($array) Read it back into an object/array $array = unserialize($string)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.