1) Store all questions in a MySQL table. Maybe add a column for "test number" or something so it can handle all the questions necessary for several tests. When generating the test, load everything into an array and create the test from that array. Be sure to be ready to stash that array in the next table I'm going to talk about.
2) Add another table and store student information. Store test number, identifying student data, and then use serialize to convert the array of questions into a string. Store that string in "text" or longer type field.
Using arrays will make your life easy here. serialize() and unserialize() are great functions. Work everything around arrays, that way it's easy to modify, sort, randomize, and generate data. MySQL is the best way to store data you are going to edit, but serialized arrays stored in MySQL are often many times easier (and sometimes faster) for lots of little, tiny settings or complex data sets.
I'm not the supreme expert on PHP here, but I've done a solid bit of coding with it and have learned a lot. I'm more into highly effective code than anything else - quick deployment, easy updating, flexible structure, reliable functionality.
Hope it helps.
On Jan 21, 2004, at 9:08 PM, Joe Harman wrote:
Thanks for your comments Chris and Rob... Chris you have great points to
make, my ears are wide open...
The reason I thought about storing the array in a blob is because every
test generated will be different. the 102 question test will be generate
randomly from a bank of 500 questions.. That means that the order of
questions will also be different... So I would like to find a way to
store that unique test for the student or administrator to review..
I do understand PHP & MySQL very well... But I am no master, that's why I was asking... Any other ideas or recommendations for this... Words of wisdom are also welcome :o)
So thanks for your input, Joe
-----Original Message----- From: Chris W [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 11:54 PM To: Robert Cummings; PHP-General Subject: Re: [PHP] Question about array limits & practicallity
Robert Cummings wrote:
Also can I store those arrays as a blob in MySQL?
You could, but you'd be better off storing them in normalized tables IMHO.
In this cans I will have to strongly agree with Rob, but I also have to add a few comments.
Why on earth would you store an array as a blob in a database!? That's
like spending $10,000 on a new storage system to organize all the junk
in your garage, and then ripping out all the bins and shelves and
cabinet door and just dumping all your junk in there. You might as well
just put it in some file on the hard drive. If your using a database
and you don't know what normalization is or you don't know how to tell
if a database is normalized, STOP and drop everything till you learn the
basics or normalization. I don't mean become an expert or anything, you
don't need to be able describe the intricacy of Boyc-Codd normal form from memory, just learn enough to have a good grasp on everything up to 3rd normal form, which isn't all that hard.
Chris W
I'm waiting till tomorrow to respond on all the challenges to my last post, so I can respond to all of them at once.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php