I have the following code.
$result = mysql_query("SELECT * FROM topics LEFT JOIN quiz ON topics.managerId = quiz.managerId WHERE quiz.userId = '$userId' AND userId= '$userId' AND $egroup = 1 GROUP BY topics.title")or die(mysql_error());
while ($row = mysql_fetch_array($result)){
echo "{$row['quizId']} <br />\n";
echo "{$row['title']} <br />\n";
echo "{$row['passState']} <br />\n";
}
My problem is that the last element "passState" (row 5) echoed in the series of arrays will only display the data taken from the first record encountered by the query. This data is repeated without change throughout the displayed array. "quizId" and "title" come from the "topics" table and "passState" comes from the "quiz" table.
The display from the other two rows (rows 3 and 4) is fine.
($userId and $egroup are values created during the login process and relate to the logged-in user.)
"passState" is tinyInt and always has a value of 0 or 1. The table has a mix of these values but always repeats the first valeu encountered.
Can anyone help me with this?