<tfoot id='54f1L'></tfoot>
    <i id='54f1L'><tr id='54f1L'><dt id='54f1L'><q id='54f1L'><span id='54f1L'><b id='54f1L'><form id='54f1L'><ins id='54f1L'></ins><ul id='54f1L'></ul><sub id='54f1L'></sub></form><legend id='54f1L'></legend><bdo id='54f1L'><pre id='54f1L'><center id='54f1L'></center></pre></bdo></b><th id='54f1L'></th></span></q></dt></tr></i><div id='54f1L'><tfoot id='54f1L'></tfoot><dl id='54f1L'><fieldset id='54f1L'></fieldset></dl></div>

        <small id='54f1L'></small><noframes id='54f1L'>

        <legend id='54f1L'><style id='54f1L'><dir id='54f1L'><q id='54f1L'></q></dir></style></legend>
          <bdo id='54f1L'></bdo><ul id='54f1L'></ul>

      1. 如何检查 UPDATE mysqli 查询是否正确执行?

        时间:2023-07-28

          <tfoot id='wqEqF'></tfoot>

            <small id='wqEqF'></small><noframes id='wqEqF'>

              <tbody id='wqEqF'></tbody>
                <bdo id='wqEqF'></bdo><ul id='wqEqF'></ul>
              • <i id='wqEqF'><tr id='wqEqF'><dt id='wqEqF'><q id='wqEqF'><span id='wqEqF'><b id='wqEqF'><form id='wqEqF'><ins id='wqEqF'></ins><ul id='wqEqF'></ul><sub id='wqEqF'></sub></form><legend id='wqEqF'></legend><bdo id='wqEqF'><pre id='wqEqF'><center id='wqEqF'></center></pre></bdo></b><th id='wqEqF'></th></span></q></dt></tr></i><div id='wqEqF'><tfoot id='wqEqF'></tfoot><dl id='wqEqF'><fieldset id='wqEqF'></fieldset></dl></div>
                • <legend id='wqEqF'><style id='wqEqF'><dir id='wqEqF'><q id='wqEqF'></q></dir></style></legend>
                  本文介绍了如何检查 UPDATE mysqli 查询是否正确执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  这是我的情况:

                  $sql = 'UPDATE user SET password = ? WHERE username = ? AND password = ?';
                  if($stmt->prepare($sql)) {
                      $stmt->bind_param('sss', $newPass, $_SESSION['username'], $oldPass);
                      $stmt->execute();
                  }
                  

                  现在,如何查看 UPDATE 查询是否成功执行?更准确地说,我如何查看旧密码和用户名是否正确,以便我可以存储新密码?我试过这样做:

                  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:

                  $res = $stmt->execute();
                  echo 'Result: '.$res;
                  

                  但我总是得到:

                  Result: 1
                  

                  即使旧密码不正确.

                  推荐答案

                  不更新行的查询不是错误条件.这只是一个没有改变任何东西的成功查询.要查看更新是否确实改变了任何内容,您必须使用 mysqli_affected_rows()

                  A query which updates no rows is NOT an error condition. It's simply a succesful query that didn't change anything. To see if an update actually did change anything, you have to use mysqli_affected_rows()

                  这篇关于如何检查 UPDATE mysqli 查询是否正确执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:PHP/MySQLi:将 lc_time_names 和 DATE_FORMAT() 设置为 mysq 下一篇:我应该将 $mysqli 变量传递给每个函数吗?

                  相关文章

                  最新文章

                  <tfoot id='kmlc0'></tfoot><legend id='kmlc0'><style id='kmlc0'><dir id='kmlc0'><q id='kmlc0'></q></dir></style></legend>

                    <i id='kmlc0'><tr id='kmlc0'><dt id='kmlc0'><q id='kmlc0'><span id='kmlc0'><b id='kmlc0'><form id='kmlc0'><ins id='kmlc0'></ins><ul id='kmlc0'></ul><sub id='kmlc0'></sub></form><legend id='kmlc0'></legend><bdo id='kmlc0'><pre id='kmlc0'><center id='kmlc0'></center></pre></bdo></b><th id='kmlc0'></th></span></q></dt></tr></i><div id='kmlc0'><tfoot id='kmlc0'></tfoot><dl id='kmlc0'><fieldset id='kmlc0'></fieldset></dl></div>

                    <small id='kmlc0'></small><noframes id='kmlc0'>

                        <bdo id='kmlc0'></bdo><ul id='kmlc0'></ul>