I feel like I'm on the verge of a breakthrough here, but I can't find the answer to a question. Can someone please tell me why there is a difference here?
Please assume the following is planted between the body tags of my PHP page.
Why does this work:
$Classes = mysql_query('SELECT * FROM Shows_Classes');
while ($row = mysql_fetch_array($Classes)) {
echo $row['ClassName'];
$Judges = mysql_query("SELECT * FROM Shows_Judges");
while ($row2 = mysql_fetch_array($Judges)) {
echo $row2['PeopleID'];
}
}
But this does not (the second, nested loop executes just once), when queries $Classes and $Judges are defined elsewhere (above the header)?
while ($row = mysql_fetch_array($Classes)) {
echo $row['ClassName'];
while ($row2 = mysql_fetch_array($Judges)) {
echo $row2['PeopleID'];
}
}
Sample Output from the first one:
Class1 123 456 789
Class2 123 456 789
Class3 123 456 789
Sample Output from the second one:
Class1 123 456 789
Class2
Classe