Jump to content

Duplicates in the dropdown list


farahZ

Recommended Posts

hey guys!!!
i was working on extractinng value from MySql and inserting them in a drop-down list

but suddenly i realized i had duplicates in the list!! but no duplicates in the table when i open mysql
thats the whole code please help :((

 

 

 <select name="foodType" onChange="autoSubmit();">
    <option VALUE=""></option>
<?PHP
  $query = "SELECT  Food, Size, Calories FROM food order by Food";
  $result = mysqli_query($con,$query);
while($row = mysqli_fetch_assoc($result)) {
    echo ("<option VALUE=\"".$row['Food']."\" " . ($food == $row['Food'] ? " selected" : "") . ">".$row['Food'].' - ' .$row['Size']. ' - '.$row['Calories']."</option>");
  }
?>
Link to comment
https://forums.phpfreaks.com/topic/278541-duplicates-in-the-dropdown-list/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.