我有以下代码。基本上,对于每个问题,如果答案是" question_id"匹配问题的ID我需要它列出问题的所有可能答案。它针对第一个问题执行此操作,但随后退出循环。
<?php foreach ($questions as $question) : ?>
<tr>
<td><?php echo $question['question']; ?></td>
<td><?php echo $question['id']; ?></td>
</tr>
<?php foreach ($answers as $answer) : ?>
<?php if ($answer['question_id'] == $question['id']) { ?>
<tr>
<td> <?php echo $answer['answer']; ?></td>
</tr>
<?php } ?>
<?php endforeach ?>
<?php endforeach; ?>
</tr>
如何继续浏览$ question [&#39; id&#39;]值的其余部分?
答案 0 :(得分:1)