title: PHP mysql, update record fails but no error
body: <p>PHP mysql, update record fail but no error.</p>
  
  <pre><code>$sql = "UPDATE users SET password='$new_password' WHERE email='$email' AND id='$uId'";
  
  //if ($mysqli-&gt;query($sql)) also result in True
  if ($mysqli-&gt;query($sql) === TRUE) {  
      $_SESSION['test6'] = $mysqli-&gt;error;  
      $_SESSION['message'] = "Your  password have been updated!";  
      header("location:gain.php");  
      }  
  else {  
      $_SESSION['test7'] = "Error updating record: " . $mysqli-&gt;error;  
    }  
  </code></pre>
  
  <p>I know why it don’t update, incorrect values in the <code>WHERE</code> clause. If the values are correct it updates just fine.
  But no errors to be seen anywhere when it fails, with or without a successful update the <code>$mysqli-&gt;query($sql)</code> are <code>true</code>.</p>
  
  <p>How to catch the error?<br>
  I'm new to this, and I should probably look into PDO or what it's called, but shouldn't mysqli give an error of some sort? This is on a XAMPP localhost. </p>