I am trying to a display options in dropdown by database.Name of table is location and loc is a column in table of varchar datatype
<select style="width: 200px;" name="location" id="myselect" onchange="window.location='enable1.php?id='+this.value+'&pos='+this.selectedIndex;">
  <option value="All">All</option>
  <?php
  $sql="select * from location";
  var_dump($sql);
  $query=mysqli_query($conn,$sql);
  echo "1";
  while($row=mysql_fetch_array($query))
  {
      echo "<option value='$row[loc]'>'$row[loc]'</option>";
  }
    ?>
</select>
But when I load the page I Dont get any output in dropdown. Only 1 option and that is "ALL". Var_dump() also outputs nothing
 
    