![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Hobbyist Programmer
|
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/ |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4
![]() |
So, what's the problem?
__________________
PFO - My daily dose of technology. |
|
|
|
|
|
#3 |
|
Expert Programmer
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4
![]() |
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. |
|
|
|
|
|
#4 |
|
Hobbyist Programmer
|
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.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|