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

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

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

        <bdo id='ecMnG'></bdo><ul id='ecMnG'></ul>
      <legend id='ecMnG'><style id='ecMnG'><dir id='ecMnG'><q id='ecMnG'></q></dir></style></legend>
    2. <small id='ecMnG'></small><noframes id='ecMnG'>

      如何確保我從 MySQLi::multi_query 中捕獲到所有錯誤

      How do I ensure I caught all errors from MySQLi::multi_query?(如何確保我從 MySQLi::multi_query 中捕獲到所有錯誤?)

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

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

              <legend id='Ej4kd'><style id='Ej4kd'><dir id='Ej4kd'><q id='Ej4kd'></q></dir></style></legend>
                <tfoot id='Ej4kd'></tfoot>

                  <tbody id='Ej4kd'></tbody>
                本文介紹了如何確保我從 MySQLi::multi_query 中捕獲到所有錯誤?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                multi_query 文檔 說:

                如果第一條語句失敗,則返回 FALSE.要從其他語句中檢索后續錯誤,您必須先調用 mysqli_next_result().

                Returns FALSE if the first statement failed. To retrieve subsequent errors from other statements you have to call mysqli_next_result() first.

                next_result 的 文檔 說:

                成功時返回 TRUE,失敗時返回 FALSE.

                Returns TRUE on success or FALSE on failure.

                最后,multi_query 文檔中發布的示例使用 next_result 的返回值來確定何時不再有查詢;例如停止循環:

                Finally, the example posted in the docs for multi_query use the return value from next_result to determine when there are no more queries; e.g. to stop looping:

                <?php
                $mysqli = new mysqli("localhost", "my_user", "my_password", "world");
                
                /* check connection */
                if (mysqli_connect_errno()) {
                    printf("Connect failed: %s
                ", mysqli_connect_error());
                    exit();
                }
                
                $query  = "SELECT CURRENT_USER();";
                $query .= "SELECT Name FROM City ORDER BY ID LIMIT 20, 5";
                
                    /* execute multi query */
                    if ($mysqli->multi_query($query)) {
                        do {
                            /* store first result set */
                            if ($result = $mysqli->store_result()) {
                                while ($row = $result->fetch_row()) {
                                    printf("%s
                ", $row[0]);
                                }
                                $result->free();
                            }
                            /* print divider */
                            if ($mysqli->more_results()) {
                                printf("-----------------
                ");
                            }
                        } while ($mysqli->next_result()); // <-- HERE!
                    }
                
                    /* close connection */
                    $mysqli->close();
                    ?>
                

                我不知道提供的查詢數量,也不知道我將要執行的 SQL.因此,我不能僅將查詢數量與返回結果的數量進行比較.然而,如果第三個查詢是損壞的查詢,我想向用戶顯示一條錯誤消息.但我似乎沒有辦法判斷 next_result 失敗是因為沒有更多的查詢要執行,還是因為 SQL 語法有錯誤.

                I don't know the number of queries provided, nor do I know anything about the SQL that I'm going to execute. I therefore can't just compare the number of queries against the number of returned results. Yet I want to display an error message to the user if, say, the third query was the broken query. But I don't seem to have a way to tell if next_result failed because there were no more queries to execute, or if it's because there was an error in the SQL syntax.

                如何檢查所有查詢是否有錯誤?

                How can I check all the queries for errors?

                推薦答案

                盡管文檔中有代碼示例,但也許更好的方法是這樣的:

                Despite the code example in the docs, perhaps the better method would be something like this:

                if ($mysqli->multi_query(...)) {
                  do {
                    // fetch results
                
                    if (!$mysqli->more_results()) {
                      break;
                    }
                    if (!$mysqli->next_result()) {
                      // report error
                      break;
                    }
                  } while (true);
                }
                

                這篇關于如何確保我從 MySQLi::multi_query 中捕獲到所有錯誤?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                相關文檔推薦

                store_result() and get_result() in mysql returns false(mysql 中的 store_result() 和 get_result() 返回 false)
                Call to undefined function mysqli_result::num_rows()(調用未定義的函數 mysqli_result::num_rows())
                PHP Prepared Statement Problems(PHP 準備好的語句問題)
                mysqli_fetch_array returning only one result(mysqli_fetch_array 只返回一個結果)
                PHP MySQLi Multiple Inserts(PHP MySQLi 多次插入)
                How do I make sure that values from MySQL keep their type in PHP?(如何確保 MySQL 中的值在 PHP 中保持其類型?)

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

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

                          <legend id='f0Ewl'><style id='f0Ewl'><dir id='f0Ewl'><q id='f0Ewl'></q></dir></style></legend>
                        1. 主站蜘蛛池模板: 国产精品久久久久久吹潮日韩动画 | 五月激情婷婷在线 | 亚洲欧美网 | 日韩一区二区在线播放 | 在线观看成年视频 | 精品一区二区三区不卡 | 欧美一极视频 | 丁香久久| 日韩欧美在线一区 | 日韩电影免费观看中文字幕 | 久草99| 美女视频h | 免费人成在线观看网站 | 91亚洲国产成人久久精品网站 | 国产精品永久免费观看 | 亚洲激情av| 香蕉视频在线播放 | 欧美精产国品一二三区 | 国产区在线观看 | 日韩精品免费在线观看 | 亚洲国产一区二区视频 | 亚洲成年人免费网站 | 久久1区| 国产成人精品一区二区三区网站观看 | 欧美成人a | 东方伊人免费在线观看 | 黄色在线免费播放 | 免费亚洲成人 | 九九久久国产 | 91在线观看免费视频 | www.成人久久 | 伊人免费观看视频 | 久久久91精品国产一区二区三区 | 亚洲精品久久久久久久不卡四虎 | 欧美在线 | 免费一二区| 亚洲精品在线看 | 国产视频久 | 91精品国产综合久久久久蜜臀 | 国产激情视频 | 久久精品一级 |