久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

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

    1. <tfoot id='LsxIA'></tfoot>
      • <bdo id='LsxIA'></bdo><ul id='LsxIA'></ul>

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

        相當(dāng)于 mysql_num_rows 或 mssql_num_rows 的 PDO

        PDO equivalent of mysql_num_rows or mssql_num_rows(相當(dāng)于 mysql_num_rows 或 mssql_num_rows 的 PDO)
          <tbody id='qQANx'></tbody>

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

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

              <i id='qQANx'><tr id='qQANx'><dt id='qQANx'><q id='qQANx'><span id='qQANx'><b id='qQANx'><form id='qQANx'><ins id='qQANx'></ins><ul id='qQANx'></ul><sub id='qQANx'></sub></form><legend id='qQANx'></legend><bdo id='qQANx'><pre id='qQANx'><center id='qQANx'></center></pre></bdo></b><th id='qQANx'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='qQANx'><tfoot id='qQANx'></tfoot><dl id='qQANx'><fieldset id='qQANx'></fieldset></dl></div>
              <tfoot id='qQANx'></tfoot>
              <legend id='qQANx'><style id='qQANx'><dir id='qQANx'><q id='qQANx'></q></dir></style></legend>
                1. 本文介紹了相當(dāng)于 mysql_num_rows 或 mssql_num_rows 的 PDO的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我知道以前有人問過這個問題,但似乎解決方案是針對所提出的問題的.

                  I know this question has been asked before but it seems like the solutions have been specific to the problem presented.

                  我有一個包含數(shù)百個使用 mssql_num_rows 實例的代碼庫.

                  I have a codebase with hundreds of instances where mssql_num_rows is used.

                  代碼示例:

                  $db->execute($sql);
                  
                  if ($db->getRowsAffected() > 0) {
                      $total = $db->fetch();
                  

                  在數(shù)據(jù)庫類中:

                  $this->rowsaffected = mssql_num_rows($this->query_result);
                  

                  • 我無法創(chuàng)建通用的 SELECT count(*) FROM table 查詢,因為我有太多特定的選擇語句.
                  • 我可以運行 preg_replace 來刪除 SELECT 和 FROM 之間的所有內(nèi)容,然后用 COUNT(*) 替換并運行第二個查詢但這假設(shè)所有查詢都以某種方式設(shè)置.
                  • 我可以先fetchAll然后count()結(jié)果,但這意味著升級if語句的所有實例.
                    • I can't create generic SELECT count(*) FROM table queries as I have too many specific select statements.
                    • I could run a preg_replace to remove everything between SELECT and FROM and then replace with a COUNT(*) and run a second query but this assumes all queries are setup a certain way.
                    • I could fetchAll first then count() the results but that means upgrading all instances of the if statements.
                    • 那么,如果人們將他們的代碼更新為 PDO,那么什么是最好的替代 *_num_rows 函數(shù)的方法.不是解決特定問題的東西,而是替代 *_num_rows 功能的東西.如果這是不可能的,以前是什么讓它成為可能的?

                      So what is the best all around replacement to a *_num_rows function if people are updating their code to PDO. Not something that solves a specific problem, but something that replaces the functionality of *_num_rows. If that's not possible what allowed it to be possible before?

                      推薦答案

                      如果你想計算行數(shù),你可以使用 PDO:

                      If you want to count the rows you can do this with PDO:

                      $sql = 'select * from users';
                      $data = $conn->query($sql);
                      $rows = $data->fetchAll();
                      $num_rows = count($rows);
                      

                      如 SELECT 語句與 PDO 一起使用時,無法直接計算行數(shù).rowcount.php" rel="nofollow noreferrer">文檔.

                      There is no way to directly count rows when using a SELECT statement with PDO as stated in the docs.

                      PDOStatement::rowCount() 返回受相應(yīng)的最后一個 DELETEINSERTUPDATE 語句影響的行數(shù)PDOStatement 對象.

                      PDOStatement::rowCount() returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement executed by the corresponding PDOStatement object.

                      僅在絕對需要計數(shù)時才進行行計數(shù),否則您可以驗證查詢是否與其他方法一起使用.如果您希望從表中返回數(shù)千行,您也不應(yīng)該使用此方法,而是在查詢中使用 COUNT() 函數(shù)來執(zhí)行計數(shù).

                      Only do a row count if you absolutely need the count, otherwise you can verify that the query worked with other methods. You should also not use this method if you expect to be returning thousands of rows from a table, instead, use the COUNT() function in a query for just performing the count.

                      這篇關(guān)于相當(dāng)于 mysql_num_rows 或 mssql_num_rows 的 PDO的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                      【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標(biāo)不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術(shù)方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動程序)
                2. <small id='cEqL3'></small><noframes id='cEqL3'>

                    <tbody id='cEqL3'></tbody>
                  <tfoot id='cEqL3'></tfoot>
                    <bdo id='cEqL3'></bdo><ul id='cEqL3'></ul>

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

                          • 主站蜘蛛池模板: 久久精品国产久精国产 | 国产99视频精品免费视频7 | 华丽的挑战在线观看 | 可以免费观看的av | 国产成人久久久 | 久久高清免费视频 | 成人免费小视频 | 日韩精品999 | 精精精精xxxx免费视频 | 欧美精品在线免费观看 | 丁香久久 | www.成人久久 | 亚洲欧美国产精品久久 | 国产日产精品一区二区三区四区 | 欧美激情第一区 | 狠狠操你 | 国产一区久久精品 | 国产成人免费在线观看 | 在线视频成人 | 亚洲交性| 成人在线精品视频 | 欧美另类视频 | 91精品久久久久久久久久入口 | 国产成人综合久久 | 美女久久久久久久久 | 日韩欧美亚洲 | 男人天堂色 | 亚洲国产一区二区三区 | 欧美一区二区三区精品 | 国产精品久久国产精品 | 成人欧美一区二区三区黑人孕妇 | 日韩欧美久久精品 | 国产免费让你躁在线视频 | 成人在线视频网 | 日韩综合一区 | 2023亚洲天堂 | 久久国产欧美日韩精品 | 天堂素人约啪 | 亚洲精品1 | 精品视频成人 | 亚洲精品成人网 |