我有两个mysql表
1. questions
2. answers
问题表有问答表有相关答案 每个答案都指向一个问题,所以它有水平
离
question 1 -> answer 1 -> question 2
-> answer 2 -> question 3
-> answer 3 -> question 4 -> answer 1 -> question 5
-> answer 2 -> question 6
-> answer 3 -> question 7
question 8 -> answer 1 -> question 9
-> answer 2 -> question 10-> answer 1 ->question 12
answer 2 ->question 13
-> answer 3 -> question 11
我需要以树状视图显示问题
离
question 1->question2
question3
question4->question 5
question 6
question 7
question 8->question 9
question 10->question 12
question 13
question 11
我的问题表字段
id qtype qtext
我的回答表字段是
id answer quzid targetquz
任何人都知道如何使用基于这两个表的php创建树视图。非常感谢你。
答案 0 :(得分:0)
希望我不会在这里误解事物(不确定你是否故意在没有任何答案的情况下回答另一个问题);但一般来说我会使用while
循环。
while()
{
first level here
while()
{
second level here
while()
{
third level here
....
}
}
}