B
B
Bags2015-07-07 22:39:31
PHP
Bags, 2015-07-07 22:39:31

Testing system. What is the best way to design a database?

I am making a fairly simple testing system: N questions with a certain number of answer options in each question.
Identification by login, then a list of questions is formed, the user marks the necessary ones, presses the send button and the data flies to the database. Then they are compared with the answers in the database and displayed on the screen. Everything.
Four types of questions:
1) One option is
selected 2) One or more answer options can be selected
3) An arbitrary answer in a text field
4) Combined (text field and checkboxes), but with one answer option
So. If the question type were only 1st (where there is one answer), then it would be something like this:
0da9f74115484d5999beba5e755fc541.png
That is, the text of the user's response, recorded in the database, would be compared with the correct answer, after which it would be displayed on the TRUE / FALSE screen.
What about question types?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel Gogolinsky, 2015-07-07
@gogolinsky

probably serialize. (I didn't do that, just a thought)

I
Ivan Vyrov, 2015-07-08
@ProKiLL

Four types of questions:
1) One option is
selected 2) One or more answer options can be selected
3) An arbitrary answer in a text field
4) Combined (text field and checkboxes), but with one answer option

Add the type_answer field to the UserAnswer table:
Accordingly, the structure of the table will be as follows:
Based on the above, when checking, you check type_answer and compare it with the corresponding result.
Note : most likely type 3 and 4 will have to be checked manually, because. people are individuals and can express their opinion in their own way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question