title: A function to capture all MySQL errors?
body: <p>Does anyone have a PHP function that for example if a <code>mysql_error()</code> happens due to well a MySQL error it will not output it?</p>
  
  <p>By not output it I mean rather it not show the error on live site as I will use it with another function I have that would work a treat if I had a MySQL error function.</p>
  
  <p>I am just finding it so annoying as I do it like this currently:</p>
  
  <pre><code>$q = mysql_query("SELECT * FROM something");
  
  // if error occurs
  if(!$q) {
     echo 'Error' . mysql_error();
  } else {
    // else no errors so continue
  }
  </code></pre>
  
  <p>On some of my webpages see I have several queries in a script and I would like to just be able to include the function at the bottom of all my PHP code and if a MySQL error occurs anywhere in my script for the function to catch the error instead of me doing multiples of the code I quoted above.</p>
  
  <p>That way I can save myself a lot of unnecessary work and implement it with my email error function.</p>