I have an odd problem. Basicly my page works fine however after a small bit of php, everything after those lines dont load too the page.
<?php
//GET SCHOOLS
$sql = "SELECT `id` FROM `school`";
$query = mysql_query($sql) or die(mysql_error());
$numschools = mysql_num_rows($query);
echo "<select id=\"schoolselect\" class=\"schoolselect\" value=\"Select School\">
<option id='selectschool' value = \"select\" name=\"select\">Select A School</option>
";
while($result = mysql_fetch_array($query) or die(mysql_error()))
{
$school = $result['id'];
echo "<option value = \"$school\" name=\"$school\">".$school ."</option>";
}
echo "</select>";
?>
everything before that works, the php part works but anything after that echo “select” doesnt
any help would be amazing
Never call
die(mysql_error())inside a fetch loop.mysql_fetch_array()returnsFALSEwhen no more rows are available, so when the last row is reached,die()is called and your script will terminate leaving the</select>unclosed. You won’t get an error message, but you’ll be left with incomplete HTML that won’t render properly in the browser.