I want a select/ dropdown menu with its options coming from the database using mysql select query.
PROBLEM: the dropdown menu displays the correct number of items inside the database but is not showing those items, just a blank option. e.g: there are four items in the database the dropdown menu has four blank options in it.
Category --Select Category--
while($result = mysqli_fetch_array($sql)){
echo "".$row[0]."";
}
?>
Can someone please tell me what's wrong?
解决方案
Change
echo "".$row[0]."";
to
echo "".$result]."";