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

  • <small id='Cde8b'></small><noframes id='Cde8b'>

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

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

        PHP->PDO 更新声明

        时间:2024-08-22

          <tbody id='0VCi0'></tbody>

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

              <legend id='0VCi0'><style id='0VCi0'><dir id='0VCi0'><q id='0VCi0'></q></dir></style></legend>

                • <bdo id='0VCi0'></bdo><ul id='0VCi0'></ul>

                  <small id='0VCi0'></small><noframes id='0VCi0'>

                  本文介绍了PHP->PDO 更新声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我试图做一个 SQL 查询(insert into users set cash = cash + 20),谁能帮我处理上述查询的 PDO 准备语句版本?

                  I was trying to do a SQL query ( insert into users set cash = cash + 20 ), can anyone help me with the PDO prepared statement version of the above query?

                  推荐答案

                  我真的不知道您是要插入还是更新.以下是 PDO 准备好的语句示例.他们假定您已经连接并且 PDO 对象是 $dbh.

                  I can't really figure out if you're looking to insert or update. Here are PDO prepared statement examples. They assume that you've already connected and that the PDO object is $dbh.

                  插入:

                  $sth = $dbh->prepare('INSERT INTO `users` (`cash`) VALUES (?)');
                  $sth->execute(array(20));
                  

                  更新:

                  // All users
                  $sth = $dbh->prepare('UPDATE `users` SET `cash` = `cash` + ?');
                  $sth->execute(array(20));
                  
                  // A specific user (assuming that there's a field name "id")
                  $sth = $dbh->prepare('UPDATE `users` SET `cash` = `cash` + ? WHERE `id` = ?');
                  $sth->execute(array(20, $id));
                  

                  这篇关于PHP->PDO 更新声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:编写 PHP SQL 更新语句的最佳方法 下一篇:具有多列的 PHP MySQL 更新集查询

                  相关文章

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

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

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

                      <tfoot id='yFEih'></tfoot>