Greetings, thanks in advance to you experts I’m trying to group some records in my database for a quiz,
I’m can’t sort out how in the world to add a closing after the last record in the group, it seems no matter how i try I get an
thanks again
here’s my code:
$theQuestions = mysql_query("
SELECT
q.id
,q.question
,a.id
,a.answer
,a.questionId
FROM
questions
AS q
INNER JOIN
answers
AS a
ON
q.id
= a.questionId
");
while($row = mysql_fetch_array($theQuestions)){
if ($cur_Qid != $row['questionId']){ //first record in this category
echo '<li>' . "\n"; // li
echo $row['question']. '<br />' . "\n" . '<br />' . "\n"; //print the category header
}
$cur_Qid = $row['questionId'];
echo '<label><input type="radio" name="question-' . $row['questionId'] . '" value="radio" />';
echo $row['answer'] . "\n";
echo '</label>' . '<br />'. "\n";
}
here’s the results in html
Poor
Below average
Average
Above average
Excellent