title: Can't handle SQL exception with try-catch
body: <p>I'm creating quite big import script.  I want to see any problematic (unexecuted) SQL queries. I have problem with catching wrong SQL queries with try-catch PHP block.</p>
  
  <p>I have a query:</p>
  
  <pre><code>SELECT id FROM tag WHERE name IN ()
  </code></pre>
  
  <p>Of course there is an error in it so I want to print queries like that with this code:</p>
  
  <pre><code>$sql = "SELECT id FROM tag WHERE name ".$tagsSql."";
  
  try
  {
      $query = mysqli_query($this-&gt;mysqli, $sql);
      $result = $query-&gt;fetch_assoc();
  }
  catch(Exception $e)
  {
      echo 'Problem with: '.$sql;
      print_r($e); die;
  }
  </code></pre>
  
  <p>When running the script PHP just throws me this:</p>
  
  <pre><code>Fatal error: Call to a member function fetch_assoc() on a non-object in C:\www\blackboard-import\index.php on line 227
  </code></pre>
  
  <p>Why this error isn't catched? Because it's fatal? How can I handle that kind of situations? 
  I use mysqli to contact with MySQL.</p>