Just to make sure I am on the same page, you want your quiz to be structured something like this:
Subject->topic->questions
For example, Subject: Animals Topic: Reptiles Only show questions about Reptile animals?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi! Wrote a long and good post, but when to post it. I got a "Whoops something went wrong", and when clicked "previous" in the browser, my post was long gone :( So let me try to recreate my post.
Im trying to create a quiz app. And for this i was thinking on going with a threaded design. With subjects, containing topics, and then the actual questions. So for example. Choosing a subject, "Cars". Then choosing a topic "Engine", then only questions about the engine. Another example. Subject "Cars", topic "Brands". Questions about car brands!
The structure i was planning is this:
Subject
Subject_id (increments)
Subject (string)
Description (text)
Image_url (string)(nullable)
softDeletes
timestamps
Topic
Topic_id (increment)
Topic (string)
Description (text)
Image_url (string)(nullable)
Subject_id
softDeletes
timestamps
Content
Content_id (increment)
Image_url (string)(nullable)
Is_Info (boolean)
Info_text (text)
Question_text (text)
Question_explaination (text)
Question_Source (text)
Topic_id
softDeletes
timestamps
And for even more simplicity, i store the questions choices separately.
Choice_id
Content
Correct (boolean)
Content_id
timestamps
So what do you guys think? How about foreign key constraints? Or other things to think about?
Please or to participate in this conversation.