title: Print SELECT list from databse using Mysqli array function
body: <p>I want to print a select list on my webpage using Mysqli select query. I have checked a lot of questions there, but i am failed to find my problem. Pls help.</p>
  
  <p><strong>php</strong></p>
  
  <pre><code>&lt;select name="bcat" id="bcat" required="required" class="search-field"&gt;
  &lt;option value="" selected="selected" disabled="disabled"&gt;Select a Category&lt;/option&gt;
  &lt;?php getTierOne(); ?&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p><strong>getTierOne()</strong></p>
  
  <pre><code>function getTierOne()
  {
     $result = mysqli_query($mysqli,"SELECT bcat FROM advertise");
  
     while($tier = mysqli_fetch_assoc($result))   
     {
       echo '&lt;option value="' .$tier['bcat'] . '"&gt;' . $tier['bcat'] . '&lt;/option&gt;';
     }
  }
  </code></pre>
  
  <p><strong>db.php</strong></p>
  
  <pre><code>$mysqli = new mysqli('localhost', 'root', '', 'lwv');
  
  if($mysqli-&gt;connect_errno &gt; 0){
  die('Unable to connect to database [' . $mysqli-&gt;connect_error . ']');
  }
  </code></pre>
  
  <p>It is working absolutely fine with sql query and syntax but not working with mysqli query. I don't have knowledge about mysqli queries so please help me out. Thanks in advance.</p>