Im using the following code. It goes through a DB and pulls out the question and the related answers.
However it displays the question each time it prints an answer.
How can I make it so the question is only printed once and then the answers are printed.
$qna = mysqli_query($conn, "SELECT q.QText, a.id, a.AText FROM question q INNER JOIN answer a ON q.id = a.Question_ID WHERE q.id=1") or die(mysqli_error($conn));
while ($data2 = mysqli_fetch_array($qna)) {
echo '<td>'.$data2['QText'].'</td>';
echo '
<table class="layout display responsive-table">
<thead>
<tr>
<th>ID</th>
<th>Answer</th>
</tr>
</thead>
<tr>
<td>'.$data2['id'].'</td>
<td>'.$data['AText'].'</td>
<td>'.$data['Group_ID'].'</td>
</table>
';
}