Your data tables are awful. You need one table for questions">questions and another table for answers. Each entry in the answers table refers back to a question in the questions">questions table and has a flag indicating whether it is the correct answer.
So, the QUESTIONS
table has the following fields:
- QUESTION_ID
- QUESTION_TEXT
QUESTION_TYPE
-- Like MC, TF, FIB ...
The ANSWERS
table has the following fields:
ANSWER_ID
- QUESTION_ID
ANSWER_TEXT
IS_CORRECT
Makes your life infinitely easier and obviates the raison d'etre for this question.
manpreet
Best Answer
2 years ago
Problem:
I'm trying to code a multiple choice quiz for my fellow students -and primarily to aid my own learning- and so I'm creating a multiple choice web-based quiz using PHP (5.2.08) and MySQL (5.0.32)
The questions table is:
Sample print_r($questions) output for one question: