title: displaying errors if mysql_query not successful
body: <p>I created a debug function to email me the mysql error and query executed if a query is not successful.</p>
  
  <p>I call it like this:</p>
  
  <pre><code>mysql_query($sql) or $this-&gt;debug-&gt;dbErrors($sql);
  </code></pre>
  
  <p>And the function is:</p>
  
  <pre><code>function dbErrors($sql = ''){
      if($this-&gt;doDebug)
          echo mysql_error()."&lt;br/&gt;".$sql;
      else
          @mail(hidden_email,$_SERVER['HTTP_HOST'].' Mysql Error','A error occured in '.$_SERVER['HTTP_HOST'].':&lt;br/&gt;'.mysql_error().'&lt;br/&gt;'.$sql);
  }
  </code></pre>
  
  <p>The problem is that i'm receiving emails even when the query executes fine (at least the data is inserted and everything works out ok)</p>
  
  <p>What i doing anything wrong?</p>
  
  <p>Thanks</p>