When I run the following php code the while loop only runs once even if there is more than one row in practice_calendar_times.
$sql = "
SELECT * FROM practice_calendar_times;
";
$result = mysql_query($sql, $con);
if($result){
while($practice = mysql_fetch_array($result)){
//... Prints data from the row + more ...
}
}
On the web page I get a printed warning message: "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /rmounts/vol0-nas/yorkweb/webs/fencing/MyWebSite/homecontent.php on line 113".
Line 113 is the while loop. I looked it up and apparently this is generally caused by a syntax error with the mysql query. However this is not the case here; the mysql is correctly pulling the first row from the database and the while loop is running once. If I replace the while with an if it does not complain and prints out one row. I also tried deleting all but one row in practice_calendar_times, but still get the warning message. However when I delete all of the rows it does not print a warning.
Any ideas on how to get the while loop to iterate through the table and stop complaining?