title: Using a 'config.php' file with mysqli
body: <p>I was recently told to stop using <code>mysql_query()</code> and instead switch to <code>mysqli()</code>. Needless to say, I'm having difficulties making these changes in my code. I'd love to fix what I currently have, however I'm also looking for the most efficient (read least typing) way of looping through the example below.</p>
  
  <p>In my config.php file</p>
  
  <pre><code>&lt;?php
      $host = 'mysql.host.com';
      $user = 'userName';
      $password = 'password';
      $database = 'database';
      $link = new mysqli();
      $link-&gt;connect($host, $user, $password, $database);
      if (mysqli_connect_errno()) {
          exit('Connect failed: '. mysqli_connect_error());
      }
  ?&gt;
  </code></pre>
  
  <p>In my index.php</p>
  
  <pre><code>$i = 0;
  $getFundsQuery = "SELECT * FROM fund";
  $getFundsResult = $link-&gt;query($getFundsQuery);
  while($i &lt; $getFundsResult-&gt;num_rows){
      echo "&lt;option value = '".$getFundsResult['fundID']."'&gt;".$getFundsResult['name']."&lt;/option&gt;";
      $i++;
  }
  </code></pre>
  
  <p>The immediate problem is that no data is being returned. And as stated above, I'm also looking for the method that would yield the least typing for looping through the results</p>