title: How to check if an UPDATE mysqli query is correctly executed?
body: <p>Here is my case:</p>
  
  <pre><code>$sql = 'UPDATE user SET password = ? WHERE username = ? AND password = ?';
  if($stmt-&gt;prepare($sql)) {
      $stmt-&gt;bind_param('sss', $newPass, $_SESSION['username'], $oldPass);
      $stmt-&gt;execute();
  }
  </code></pre>
  
  <p>Now, how can I see if the UPDATE query is successfully executed? And more precisely how can I see if the old password and username are correct so that I can store the new password?
  I've tried by doing this:</p>
  
  <pre><code>$res = $stmt-&gt;execute();
  echo 'Result: '.$res;
  </code></pre>
  
  <p>But I always get:</p>
  
  <pre><code>Result: 1
  </code></pre>
  
  <p>even if the old password is not correct.</p>