I tried inserting this into my code to generate a dropdown menu through an sql table but it responds with nothing in the dropdown. When I execute the sql query it doesn't show any error as well. Please be kind enough to fix my error. Thank you
<?php
$db = mysqli_connect('localhost', 'root', '', 'registration');
$sql = "Select (unitid) from unit where (unitname)=
('$unitname')";
mysqli_query($db, $sql);
echo "<select name='unitid'>";
while ($row = mysql_fetch_array($sql)) {
echo "<option value='" .$row['unitid']."'> ".$row['unitname'] . "</option>";
}
echo "</select>";
?>