Thanks in advance, I’m new to php and mysql.
I’m trying to create a quiz with multiple choice answers…
Each question might have 5 answers, I have a database with 2 tables
Questions, Answers
I can’t sort out how to associate the answers and questions here’s my code
[b]$theQuestions = mysql_query("SELECT
questions.id,
questions.question,
answers.id,
answers.answer,
answers.questionId
FROM
questions ,
answers
WHERE
questions.id = answers.questionId[/b]
while($row = mysql_fetch_array($theQuestions))
{
echo $row[‘question’];
echo “—
”;
echo $row[‘answer’];
echo $row[‘answer’];
echo $row[‘answer’];
echo $row[‘answer’];
echo $row[‘answer’];
}
I keep getting the same “answer” and can’t sort out how to get different answers for each question
Any help would be great, thanks!