[英]Output data from multiple MySql tables with PhP
I have 3 MySql tables:我有 3 个 MySql 表:
I want to output every quiz separately with all the questions and the answers its contents, following this structure:我想按照以下结构分别输出每个测验及其所有问题和答案的内容:
Questionnaire 1问卷 1
Question 1问题 1
a.一种。 Answer 1 b.
答案 1 B. Answer 2 c.
答案 2 C. Answer 3 d.
答案 3 d。 Answer 4 e.
答案 4 e。 Answer 5
答案 5
Question 2问题2
a.一种。 Answer 1 b.
答案 1 B. Answer 2 c.
答案 2 C. Answer 3 d.
答案 3 d。 Answer 4 e.
答案 4 e。 Answer 5
答案 5
etc.等等。
Questionnaire 2问卷 2
Question 1问题 1
a.一种。 Answer 1 b.
答案 1 B. Answer 2 c.
答案 2 C. Answer 3 d.
答案 3 d。 Answer 4 e.
答案 4 e。 Answer 5
答案 5
Question 2问题2
a.一种。 Answer 1 b.
答案 1 B. Answer 2 c.
答案 2 C. Answer 3 d.
答案 3 d。 Answer 4 e.
答案 4 e。 Answer 5
答案 5
etc.等等。
I have tried for a few days and I can't succeed.我已经尝试了几天,但无法成功。 All I got is all the answers below all the questions... I would be very grateful for any help.
我得到的只是所有问题下面的所有答案......我将非常感谢您的帮助。
You can do a query with all the 3 tables and information, but that's not the correct approach.您可以对所有 3 个表和信息进行查询,但这不是正确的方法。 Having a table with the quiz, questions and answers will have a lot of repetition and will lose the purpose.
有一个带有测验,问题和答案的表格将有很多重复并且会失去目的。
You should query for the lists of quizes, then query que questions and do a table with all the answers.您应该查询测验列表,然后查询问题并制作包含所有答案的表格。
Those are my 2 cents.那是我的 2 美分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.