title: How to see MySQL query error details?
body: <p>I am trying to insert into a table, but it's not working. So I told my application if you can't INSERT then redirect to home.php, which it's doing. So, there's definetely error somewhere. But, it doesn't tell me, is there way to see query errors? Here's the code:</p>
  
  <pre><code>if(0 === count($errors)){
  // Sanitize name and phone number
    $contact_name = mysql_real_escape_string($_POST['name']);
    $phone_number  = mysql_real_escape_string($_POST['phone_number']);
  
    $query = "INSERT INTO `ani` (`ContactName`,  `PhoneNumber`)
              VALUES            ('$contact_name', '$phone_number'";
  
    $result = mysql_query($query);
  
    if(mysql_errno() === 0){
      header("Location: pinless.php");
    } else {
      header("Location: home.php");
      // Here I want to see what the heck is wrong with the above query
      // instead of redirecting
    }
  }
  </code></pre>