'design MYSQL database for Multiple page Quiz PHP script

I'm trying to design MYSQL database for my Quiz PHP script where

One page would have:

Quiz title

Question 1

Question 2

.

.

Question X

Answer 1

Answer 2

.

.

Answer X


Second page would have:

Quiz title 2

Question 1

Question 2

.

.

Question X

Answer 1

Answer 2

.

.

Answer X


and so on....

Number of questions is variable for all pages, as so as the number of options.

Picture for clear understanding

How I can design the database for such thing? I'm using this basic guide here: https://www.etutorialspoint.com/index.php/342-how-to-create-a-multiple-choice-quiz-in-php-and-mysql Thanks,



Solution 1:[1]

It seems like you would like to have one page per quiz, so you would need three simple tables:

  • Quiz (id, name)
  • Question (id, quiz_id, question)
  • Answer (id, question_id, correct (1/0))

That would be the basics to get you started, good luck!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Blake A. Nichols