title: Get MySQL Error Message from Only the Error Code
body: <p>What's the point of MySQL error Codes (like 1054)?</p>
  
  <p>The error messages contain the actual information, so there must be some way of getting some more information out of the error codes.</p>
  
  <p>But what can I use to get anything from the error code alone compared to the error message?</p>
  
  <p>Normally you get both with :</p>
  
  <pre><code>&lt;?PHP
  $db_link = new mysqli($hostname, $username, $password, $database);
  
  $statement = $db_link-&gt;prepare('SELECT SomeFieldThatDoesNotExist FROM Person');
  $statement-&gt;execute();
  
  if(!$statement) {
      $specific_error = $db_link-&gt;error;
      $error_number = $db_link-&gt;errno;
  }
  ?&gt;
  </code></pre>
  
  <p>Imagine that I have error 1054 (see: <a href="https://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html#error_er_bad_field_error" rel="nofollow noreferrer">https://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html#error_er_bad_field_error</a>).</p>
  
  <p>With just the number 1054, what can I use to get the actual MySQL error message itself?</p>