title: mysqli::error() is not detected
body: <p>I'm beginner in php and I have a problem that I can not explain by myself.. I have two files: the first one index.html:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;meta charset="utf-8" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form enctype="multipart/form-data" action="upload.php" method="post"&gt;
          &lt;input name="file" type="file"/&gt;
          &lt;input type="submit" value="Wyslij" /&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and the second one upload.php:</p>
  
  <pre><code>&lt;?php
  
  if(isset($_FILES['file'])){
  $db=new mysqli('localhost','root','kursphp','products');
  
      $name= $db-&gt;real_escape_string($_FILES['file']['name']);
      $type=$db-&gt;real_escape_string($_FILES['file']['type']);
      $data=$db-&gt;real_escape_string(file_get_contents($_FILES['file']['tmp_name']));
      $size=intval($_FILES['file']['size']);
  
      //question
  
      $query= "INSERT INFO files(name,type,size,data,created) VALUES ('{$name}','{$type}','{$size}','{$data}',NOW())";
  
      $result=$db-&gt;query($query);
  
      if($result){
      echo "File saved";
      } else {
          echo $db-&gt;error();
      }
  
      $db-&gt;close();
  }
  
  ?&gt;
  </code></pre>
  
  <p>When I upload some file, I get an error:</p>
  
  <pre><code>Fatal error: Call to undefined method mysqli::error() in D:\wamp\www\php_z\upload\upload.php on line 20
  </code></pre>
  
  <p>I don't know why I get this kind of error because as I declared: db is an object of mysqli. I read in documentation of PHP that</p>
  
  <pre><code>mysqli::$error -- mysqli_error — Returns a string description of the last error
  </code></pre>
  
  <p>So there is method such <code>error()</code>.. Can someone tell me how to fix this?</p>