title: How to populate dropdown menu from sql table in PHP
body: <p>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</p>
  
  <pre><code> &lt;?php
              $db = mysqli_connect('localhost', 'root', '', 'registration');
              $sql = "Select (unitid) from unit where (unitname)=
  ('$unitname')";
              mysqli_query($db, $sql);
  
              echo "&lt;select name='unitid'&gt;";
              while ($row = mysql_fetch_array($sql)) {
                 echo "&lt;option value='" .$row['unitid']."'&gt; ".$row['unitname'] . "&lt;/option&gt;"; 
              }
              echo "&lt;/select&gt;";
              ?&gt;
  </code></pre>