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

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

          <bdo id='Sd1wV'></bdo><ul id='Sd1wV'></ul>
      1. Zend DB 受影响的行数(更新)

        Number of affected rows Zend DB (UPDATE)(Zend DB 受影响的行数(更新))

        1. <tfoot id='tOciu'></tfoot><legend id='tOciu'><style id='tOciu'><dir id='tOciu'><q id='tOciu'></q></dir></style></legend>

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

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

              • <bdo id='tOciu'></bdo><ul id='tOciu'></ul>
                  <tbody id='tOciu'></tbody>
                  本文介绍了Zend DB 受影响的行数(更新)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我是 Zend Framework 的新手,我想知道如何从中获取受影响的行数:

                  I'm new to Zend Framework and I'd like to know how I can get the number of affected rows from this:

                  $sql = "UPDATE auth SET act='', status='1' WHERE username = ? AND act = ? ";
                  $stmt = $this->dbh->prepare($sql);
                  $stmt->execute(array($this->username, $this->key));
                  

                  我在这个论坛上看到了一些帖子,但它们基于 MySQLi 和 SELECT 语句,您可以使用 count() 实际计算行数.

                  I saw a few posts on this forum, but they we based on MySQLi and SELECT statements where you can actually count the rows using count().

                  谁能建议我如何更改它以支持 rowCount.

                  Can anyone suggest how I can alter this to support rowCount.

                  这是我连接到我的数据库的方式:

                  This is how I connect to my database:

                  $parameters = array(
                      'host' => 'localhost',
                      'username' => 'root',
                      'password' => '',
                      'dbname' => 'users'
                  );
                  
                  try {
                          $db = Zend_Db::factory('Pdo_Mysql', $parameters);
                  ...
                  

                  这是在我的 Bootstrap.php 中.我这样做是因为我使用了多个数据库.

                  This is in my Bootstrap.php. I did it this way because I work with more than one databases.

                  推荐答案

                  Zend_Db_Statement_Pdo 有一个 rowCount() 方法.

                  Zend_Db_Statement_Pdo has a rowCount() method.

                  请参阅 API 文档

                  返回受此语句对象执行的最后一条 INSERT、DELETE 或 UPDATE 语句影响的行数.

                  Returns the number of rows affected by the execution of the last INSERT, DELETE, or UPDATE statement executed by this statement object.

                  这意味着您可以简单地:-

                  This means you can simply:-

                  $rowsAffected = $stmt->rowCount();
                  

                  在调用 execute() 之后,您应该立即获得受影响的行数.

                  Straight after calling execute() and you should get the number of rows affected.

                  这篇关于Zend DB 受影响的行数(更新)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)
                  MySQL GROUP BY DateTime +/- 3 seconds(MySQL GROUP BY DateTime +/- 3 秒)
                  MySQL cumulative sum grouped by date(按日期分组的 MySQL 累计总和)

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

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

                          1. <tfoot id='BxSjw'></tfoot>