title: Fatal error: Call to a member function query() on a non-object in admin.php on line 219
body: <p>I've searched a lot of basically the same questions on SO which haven't seemed to help. Been a while since i've touched php so i'm guessing there's a simple solution but really can't figure it out.</p>
  
  <p>config.php: (included into admin.php)</p>
  
  <pre><code>$mysqli = new mysqli($mHost, $mUser, $mPass, $db);</code></pre>
  
  <p>admin.php:</p>
  
  <pre><code>$sqlQuery = "INSERT INTO `category` (`id`, `name`) VALUES ('', '$_POST[name]')";
  $result = $mysqli->query($sqlQuery);</code></pre>
  
  <p>var_dump($result) returns: </p>
  
  <blockquote>
    <p>NULL</p>
  </blockquote>
  
  <p>and gives error: </p>
  
  <blockquote>
    <p>Fatal error: Call to a member function query() on a non-object in</p>
  </blockquote>