我想创建简单的投票系统。我有两个问题和两个答案。第一个问题有两个答案,但第二个问题没有任何答案。从某种意义上说,我想得到:
First question?
Answer1
Answer2
Second question?
但我越来越
First question?
Answer1
Answer2
Second question?
Answer1
Answer2
第二个问题不需要有 Answer1 和 Answer2(与第一个问题的答案相同,但我在 mysql 中有两个答案)。
还有我的 foreach 循环。我需要如何更改循环?
foreach($sorular->soruCek($_GET["kategori"]) as $data) // Questions
{
echo $data["soru"] . "<br/>";
foreach($sorular->cevapCek($data["id"]) as $cevaplar) // Answers
{
echo $cevaplar["cevap"] . "<br/>"; // This needn't print data to below of Second Question
}
}