![]() |
Test Questions:
Hello Everyone! I have this big @$$ problem. I'm supposed to create a testing application via PHP and MySQL. Alright I have an idea for the table that contains all the answers and the Questions:
TestID, Q/A, Ref#, CorrectAnswer, value, Points 1, Q, 1, 0, How do you spell blue? 50 1, A, 1, 0, blu 0 1, A, 2, 0, ble 0 1, A, 3, 0, blw 0 1, A, 4, 1, blue 50 On The Website: #1 How do you spell Blue? A: blu B. ble C. Blw D. blue After Event: Coeect Answer is D Then when you have this for the grading: TestID, UserID, Q#, A#, Correct, Points 1 34 1 4 1 50 Where the Correct 1 is True if you guys need any more information let me know. Here is my site for it: http://esit.philbon.com/ |
So, what's the problem?
|
How about this: Create three tables.
Table1:Questions: TestID,QID,Question PK: TestID,QID 1,1,'How To spell Blue' 1,2,'What's 1 + 1' Table2:Choices: QID,AID,Answer PK:QID,AID 1,1,'Blue' 1,2,'Blu' 1,3,'Ble' 1,4,'Blew' 2,1,'2' 2,2,'10' 2,3,'11' 2,4,'0' Table3(Bridge):Correct Answers: QID,AID,Points PK:QID,AID 1,1,20 2,2,30 This way, your database will be more dynamic, you don't have to check if this is a Q or A, and it will be easier to maintain or add an answer or question in the future. |
Thanks OpenLoop. I was thinking about that last night, and Based on what you said it looks like that'll be the best way to go. If anyone has anymore ideas, let me know. If I don't use it in V0.1 I could probably use it in V0.5 or V 1.0.
|
| All times are GMT -5. The time now is 10:44 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC