fetch data from database and display in dropdownlist

i am trying to fetch a data from my database and display it in my dropdownlist
but i cant get the result i try the other post here but cant understand

anyone can help me with this plssss this is for my project

<?php

      $connection =mysqli_connect('localhost', 'root', '','mjj_app');


      $sql="SELECT food FROM menu";
      $lists=mysql_query($sql);

    echo"<select name='fname' id='mySelect' value='Foodname'>"
                        while($food = mysql_fetch_array($lists)) {
   echo '<option value='.$food['food'].'>'.$food['food'].'</option>'; 
                        }
    echo '</select>';
?>


Source: css

Leave a Reply