I’m completely stumped here. I’ve written the code below and when I view the page I get a 500 error. Via process of commenting out select lines one by one I was able to find that the while statement is causing the error…could anyone tell me what could possible be wrong with my code?
<?php
$rQuery = "SELECT * FROM roles ORDER BY roleName ASC";
$rResult = mysql_query($rQuery);
if (!$rResult){
echo 'Query Error <br>' . $rQuery;
exit;
}
?>
<p>
<select name="roleaddid" id="roleaddid" >
<?php while ($roles = mysql_fetch_array($rResult)){ ?>
<option value="<?php echo $roles['roleId'] ?>"><?php echo $roles['roleName'] ?></option>
<? } // end while ?>
</select>
</p>
thanks for any insight…
You need to fix the
<? ?>around your ending brace.Change to
<?php ?>