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)



I would have a table for questions, a table for answers, a table for students and a table for tests. Leaving the answers in the questions table probably wouldn't be that bad. And if you always have the same set of answers to every question and in the same order that might be a little easier, but Ideally the answers should be in a separate table. I am thinking you would have more than one test during a class so I would also have a test table for that.


TestListTable with say 3 fields, TestKey, TestDate, TestDescription.

QuestionTable would have 4 fields; QuestionKey, TestKey, Question, and CorrectAnswer which would be the key to the correct answer in the answer table.

AnswerTable; Also with 3 fields a dual key, (AnswerKey, QuestionKey), and Answer.

StudentTable; would just be a list of students with what ever information you normally store about your students.

TestTable, I wold make this a triple key table, (StudentKey, TestKey, QuestionKey) and QuestionNum to indicate the order of the question on the test.

I would write code to fill TestTable with 102 randomly ordered questions from the QuestionTable for each student.

then to get the answers to questions for test X took by student Y I would do this query

SELECT Question, Answer, QuestionNum
FROM QuestionTable q, AnswerTable a, TestTable t, StudentTable s,
WHERE t.StudentKey = y AND t.TestKey = x AND a.QuestionKey = q.CorrectAnswer
   AND  q.QuestionKey = t.QuestionKey
ORDER BY QuestionNum

A similar select could be used to create the test for each student.

Since I haven't tested any of this that SQL may not be right and given the nature of this database, the names I used for the Unique Identifier fields (TestKey, AnswerKey, QuestionKey) could be confusing. Maybe TestID, AnswerID, QuestionID would be better.

Feel free to ask for more details or critique my and fix anything in my design.

Chris W

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to