<small id='4sQV1'></small><noframes id='4sQV1'>

<tfoot id='4sQV1'></tfoot>
    • <bdo id='4sQV1'></bdo><ul id='4sQV1'></ul>
  • <legend id='4sQV1'><style id='4sQV1'><dir id='4sQV1'><q id='4sQV1'></q></dir></style></legend>

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

      1. PHP5 的 PDO rowCount MySQL 问题的解决方法

        时间:2023-09-19
          1. <small id='YOaFV'></small><noframes id='YOaFV'>

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

                <tfoot id='YOaFV'></tfoot>
                • <bdo id='YOaFV'></bdo><ul id='YOaFV'></ul>
                • <legend id='YOaFV'><style id='YOaFV'><dir id='YOaFV'><q id='YOaFV'></q></dir></style></legend>
                    <tbody id='YOaFV'></tbody>
                  本文介绍了PHP5 的 PDO rowCount MySQL 问题的解决方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我最近开始使用 PHP5 开发一个新项目,并希望使用他们的 PDO 类.问题是 MySQL PDO 驱动程序不支持 rowCount(),因此无法运行查询然后获取受影响的行数或返回的行数,就我而言,这是一个非常大的问题.我想知道之前是否有其他人处理过这个问题,以及您为解决这个问题做了什么.必须执行 fetch() 或 fetchAll() 来检查是否有任何行受到影响或返回对我来说似乎是一种黑客行为,我宁愿只执行 $stmt->numRows() 或类似的操作.

                  I've recently started work on a new project using PHP5 and want to use their PDO classes for it. The problem is that the MySQL PDO Driver doesn't support rowCount() so there's no way to run a query and then get the number of affected rows, or rows returned, which is a pretty big issue as far as I'm concerned. I was wondering if anyone else has dealt with this before and what you've done to work around it. Having to do a fetch() or fetchAll() to check if any rows were affected or returned seems like a hack to me, I'd rather just do $stmt->numRows() or something similar.

                  推荐答案

                  您可以在原始 SELECT 查询之后立即发出 SELECT FOUND_ROWS() 查询以获取行数.

                  You can issue a SELECT FOUND_ROWS() query right after the original SELECT query to get row count.

                  $pdo->query("SELECT * FROM users");
                  $foundRows = $pdo->query("SELECT FOUND_ROWS()")->fetchColumn();
                  

                  另见:关于 FOUND_ROWS 的 MySQL 文档()

                  这篇关于PHP5 的 PDO rowCount MySQL 问题的解决方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:PDO bindParam 成一个语句? 下一篇:bindValue() 和 bindParam() 之间的混淆?

                  相关文章

                  最新文章

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

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

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