Need some help with a While loop
Posted: Thu Aug 04, 2011 1:36 pm
I'm having some problems with this while loop. When I run this query from my MYSQL console for #506 I get 3 rows in set but this code only returns result #2 & #3. What am I doing wrong?
Many thanks in advance
-J
Many thanks in advance
-J
Code: Select all
<?php
$student_ensemble_query="SELECT e.ensemble_description
FROM ensemble AS e
JOIN ensemble_student AS es ON e.ensemble_ID = es.ensemble_ID
WHERE es.student_ID = 506;";
$ensemble_detail=mysql_query($student_ensemble_query) or die("Josh sucks at SQL and query failed with error: ".mysql_error());
$info = mysql_fetch_array($ensemble_detail);
mysql_close();
?>
<?php
while($info = mysql_fetch_array($ensemble_detail))
{
echo "".$info['ensemble_description']. "<br>" ;
}
?>