what if you link it in the same table like this
Questions:
|-> -id;
| - survey_id;
|-> - question_id;
- label;
- input_type;
- options;
- order;
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi there, im creating a app the creates surveys. But im struggling in the database structure.
My Tables:
Surveys:
- id;
- user_id;
- title;
- status;
Questions:
- id;
- survey_id;
- label;
- input_type;
- options;
- order;
My only issue is that i need to be able to create some kind of cascading or populate feature. For example imagine that i have a question (radio button) where the answer have 2 options, "yes" or "no", but in case that the user selects "yes" for example it appears another question. How i would structure my tables?
Please or to participate in this conversation.