title: MySQL server has gone away - ErrorException
body: <p>I started getting this error when trying to query the database on a connection that had timed out.</p>
  
  <pre><code>Fatal error: Uncaught exception 'ErrorException' with message 'mysql_query(): MySQL server has gone away'
  </code></pre>
  
  <p>So I did a bunch of research and 99% of the users on the forum say you can use the <strong>mysql_ping</strong> command to check for a connection, so I put this in place:</p>
  
  <pre><code>if(!mysql_ping($this-&gt;sDBLink))
      Connect(true);
  </code></pre>
  
  <p>Now I get the same error, just in reference to the <strong>mysql_ping</strong> function instead of the <strong>mysql_query</strong> function:</p>
  
  <pre><code>Fatal error: Uncaught exception 'ErrorException' with message 'mysql_ping(): MySQL server has gone away'
  </code></pre>
  
  <p><strong>How do I reliably check that a connection still exists?</strong>  mysql_ping throws an exception.</p>