title: mysqli_error() expects exactly 1 parameter, 0 given
body: <p>I am trying to get my head around mysql.  Can someone tell my why this mysql query is not working? I am getting the following error:</p>
  
  <blockquote>
    <p>Warning: mysqli_error() expects
    exactly 1 parameter, 0 given in
    /home/freebet2/public_html/test.php on
    line 11</p>
  </blockquote>
  
  <p><strong>test.php</strong></p>
  
  <pre><code>&lt;?php
          require_once($_SERVER['DOCUMENT_ROOT'].'/includes/db.php');
          $conn = db_connect();
          $result = $conn-&gt;query("ALTER TABLE users ADD COLUMN refer_old INT(10) AFTER refer_id");
  
                if(!$result){
                   echo "Error with MySQL Query: ".mysqli_error();
               }
          ?&gt;
  </code></pre>
  
  <p><strong>db.php</strong></p>
  
  <pre><code> &lt;?php
  
      function db_connect() {
         $result = new mysqli('localhost', 'user', 'password', 'db');
         if (!$result) {
           throw new Exception('Could not connect to database server');
         } else {
           return $result;
         }
      }
  
      ?&gt;
  </code></pre>
  
  <p>If I change the alter string to something like : <code>$result = $conn-&gt;query("SELECT * FROM users refer_id");</code> I get no error for some reason.</p>