<tfoot id='Ahqu0'></tfoot>

      • <bdo id='Ahqu0'></bdo><ul id='Ahqu0'></ul>

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

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

      PDO 错误:&quot;SQLSTATE[HY000]:一般错误更新数据库

      时间:2023-09-21
          <bdo id='HWB3R'></bdo><ul id='HWB3R'></ul>

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

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

                本文介绍了PDO 错误:&quot;SQLSTATE[HY000]:一般错误更新数据库时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我在使用 PDO 更新数据库时遇到错误.我是 PDO 的新手,所以问题可能很小,我只是不明白.这个错误很有趣,命令运行良好,数据库确实得到了更新.但它仍然向我返回一个错误.

                I am getting an error when updating a database using PDO. I am new to PDO so maybe the problem is a small one and I just don't understand. Funny thing about the error, the command works fine and the database does actually get updated. But it still returns an error back at me.

                代码:

                try {
                    $stmt = $pdo->prepare("UPDATE $page SET $section = :new_content WHERE $section = '$old_content'");
                    $stmt->execute(array(
                        'new_content' => $new_content
                    ));
                    $result = $stmt->fetchAll();
                    echo "Database updated!";
                }
                catch(PDOException $e) {
                    echo 'ERROR UPDATING CONTENT: ' . $e->getMessage();
                }
                

                错误:错误更新内容:SQLSTATE[HY000]:一般错误

                Error: ERROR UPDATING CONTENT: SQLSTATE[HY000]: General error

                我真的不知道问题出在哪里,因为它非常空洞,而且我找不到任何有同样问题的人.

                I literally have no idea where the problem could be because its very vaque and I haven't been able to find anyone with the same problem.

                推荐答案

                你不使用 fetchAll(),如

                You do not use fetchAll(),as in

                $result = $stmt->fetchAll();
                

                带有更新或插入查询.删除此语句应该可以解决问题.

                with update or insert queries. Removing this statement should rectify the problem.

                这篇关于PDO 错误:&quot;SQLSTATE[HY000]:一般错误更新数据库时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何用 PDO 替换 MySQL 函数? 下一篇:带有“WHERE ... IN"的 PDO查询

                相关文章

                最新文章

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

                <legend id='F9TaC'><style id='F9TaC'><dir id='F9TaC'><q id='F9TaC'></q></dir></style></legend>

                  1. <small id='F9TaC'></small><noframes id='F9TaC'>

                    <tfoot id='F9TaC'></tfoot>

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