pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

  • <legend id='FxqTu'><style id='FxqTu'><dir id='FxqTu'><q id='FxqTu'></q></dir></style></legend>

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

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

        嚴格的標準:mysqli_multi_query 的 mysqli_next_result() 錯

        Strict Standards: mysqli_next_result() error with mysqli_multi_query(嚴格的標準:mysqli_multi_query 的 mysqli_next_result() 錯誤)
        <i id='z6dD5'><tr id='z6dD5'><dt id='z6dD5'><q id='z6dD5'><span id='z6dD5'><b id='z6dD5'><form id='z6dD5'><ins id='z6dD5'></ins><ul id='z6dD5'></ul><sub id='z6dD5'></sub></form><legend id='z6dD5'></legend><bdo id='z6dD5'><pre id='z6dD5'><center id='z6dD5'></center></pre></bdo></b><th id='z6dD5'></th></span></q></dt></tr></i><div class="vxrdrvr" id='z6dD5'><tfoot id='z6dD5'></tfoot><dl id='z6dD5'><fieldset id='z6dD5'></fieldset></dl></div>

            <tbody id='z6dD5'></tbody>
          • <bdo id='z6dD5'></bdo><ul id='z6dD5'></ul>

            • <tfoot id='z6dD5'></tfoot>

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

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

                  本文介紹了嚴格的標準:mysqli_multi_query 的 mysqli_next_result() 錯誤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我曾嘗試使用 multi_query,但我不斷收到嚴格的標準消息.

                  I have tried using multi_query but I keep getting a strict Standards message popping up.

                  $querystring = "INSERT INTO responses VALUES('1', '2', '3', '4'); INSERT INTO responses VALUES('1', '2', '3', '4')";
                  
                  if (mysqli_multi_query($db, $querystring)) {
                     do {
                         if ($result = mysqli_store_result($db)) {
                             //
                         }
                     } while (mysqli_next_result($db));
                  }
                  echo "end";
                  

                  我得到的錯誤信息是:

                  嚴格標準:mysqli_next_result():沒有下一個結果集.請調(diào)用mysqli_more_results()/mysqli::more_results()檢查是否調(diào)用這個函數(shù)/方法

                  Strict Standards: mysqli_next_result(): There is no next result set. Please, call mysqli_more_results()/mysqli::more_results() to check whether to call this function/method

                  我嘗試添加和刪除 -; 但沒有成功.

                  I've tried adding and removing -; but had no luck.

                  推薦答案

                  雖然 pipodesign 更正了 $querystring 中的錯誤并緩解了問題,但并未提供有關 Strict Standards 錯誤的實際解決方案.

                  While pipodesign corrected the error within the $querystring and alleviated the problem, the actual solution was not provided regarding the Strict Standards error.

                  我不同意 SirBT 的建議,沒有必要從 DO WHILE 更改為 WHILE.

                  I disagree with SirBT's advice, changing from DO WHILE to WHILE is not necessary.

                  您收到的嚴格標準消息非常有用.要服從,請使用:

                  The Strict Standards message that you receive is quite informative. To obey, use this:

                  do{} while(mysqli_more_results($db) && mysqli_next_result($db));
                  

                  然后,您無需在循環(huán)內(nèi)部編寫條件退出或中斷,因為 while 條件將在第一次出現(xiàn)錯誤時中斷循環(huán).*注意,如果第一個查詢有錯誤,則 do-while 之前的 if 語句將拒絕進入循環(huán).

                  Then, there is no need for you to write a conditional exit or break inside of the loop because the while condition will break the loop on the first occurrence of an error. *note, the if statement before the do-while will deny entry to the loop if the first query has an error.

                  在您的示例中,您只運行 INSERT 查詢,因此您不會收到任何要處理的結果集.如果要計算添加了多少行,請使用 mysqli_affected_rows().

                  In your example, you are only running INSERT queries, so you won't receive any result sets to process. If you want to count how many rows you've added, use mysqli_affected_rows().

                  作為您問題的完整解決方案:

                  As a complete solution for your question:

                  if(mysqli_multi_query($db,$querystring)){
                      do{
                          $cumulative_rows+=mysqli_affected_rows($db);
                      } while(mysqli_more_results($db) && mysqli_next_result($db));
                  }
                  if($error_mess=mysqli_error($db)){echo "Error: $error_mess";}
                  echo "Cumulative Affected Rows: $cumulative_rows";
                  

                  輸出:

                   // if no errors
                  Cumulative Affected Rows: 2
                  
                  // if error on second query
                  Error: [something]
                  Cumulative Affected Rows: 1
                  
                  // if error on first query
                  Error: [something]
                  Cumulative Affected Rows: 0
                  

                  <小時>

                  后期

                  由于剛接觸 mysqli 的人在這篇文章中遇到了困難,我將提供一個通用但強大的代碼段來使用 multi_query() 處理有/沒有結果集的查詢,并添加一個功能來顯示正在處理數(shù)組中的哪個查詢...

                  Since people new to mysqli are stumbling across this post, I'll offer a general yet robust snippet to handle queries with/without result sets using multi_query() and add a feature to display which query in the array is being handled...

                  經(jīng)典的IF(){DO{} WHILE}"語法:

                  if(mysqli_multi_query($mysqli,implode(';',$queries))){
                      do{
                          echo "<br><br>",key($queries),": ",current($queries);  // display key:value @ pointer
                          if($result=mysqli_store_result($mysqli)){   // if a result set
                              while($rows=mysqli_fetch_assoc($result)){
                                  echo "<br>Col = {$rows["Col"]}";
                              }
                              mysqli_free_result($result);
                          }
                          echo "<br>Rows = ",mysqli_affected_rows($mysqli); // acts like num_rows on SELECTs
                      } while(next($queries) && mysqli_more_results($mysqli) && mysqli_next_result($mysqli));
                  }
                  if($mysqli_error=mysqli_error($mysqli)){
                      echo "<br><br>",key($queries),": ",current($queries),"Syntax Error:<br>$mysqli_error";  // display array pointer key:value
                  }
                  //if you want to use the snippet again...
                  $mysqli_error=null; // clear variables
                  reset($queries); // reset pointer
                  

                  <小時>

                  重新發(fā)明的輪子WHILE{}"語法(...對于那些不喜歡測試后循環(huán)的人):


                  Reinvented Wheel "WHILE{}" Syntax (...for those who don't like post-test loops):

                  while((isset($multi_query) && (next($queries) && mysqli_more_results($mysqli) && mysqli_next_result($mysqli))) || (!isset($multi_query) && $multi_query=mysqli_multi_query($mysqli,implode(';',$queries)))){
                      echo "<br><br>",key($queries),": ",current($queries);  // display array pointer key:value
                      if($result=mysqli_store_result($mysqli)){
                          while($rows=mysqli_fetch_assoc($result)){
                              echo "<br>Col = {$rows["Col"]}";
                          }
                          mysqli_free_result($result);
                      }
                      echo "<br>Rows = ",mysqli_affected_rows($mysqli); // acts like num_rows on SELECTs
                  }
                  if($mysqli_error=mysqli_error($mysqli)){
                      echo "<br><br>",key($queries),": ",current($queries),"Syntax Error:<br>$mysqli_error";  // display array pointer key:value
                  }
                  //if you want to use the snippet again...
                  $multi_query=$mysqli_error=null; // clear variables
                  reset($queries); // reset pointer
                  

                  因此,給出以下查詢的任一片段都將提供相同的輸出:

                  So, either snippet given the following queries will offer the same output:

                  查詢數(shù)組:

                  $queries[]="SELECT * FROM `TEST`";
                  $queries[]="INSERT INTO `TEST` (Col) VALUES ('string1'),('string2')";
                  $queries[]="SELECT * FROM `TEST`";
                  $queries[]="DELETE FROM `TEST` WHERE Col LIKE 'string%'";
                  

                  輸出:

                  0: SELECT * FROM `TEST`
                  Rows = 0
                  
                  1: INSERT INTO `TEST` (Col) VALUES ('string1'),('string2')
                  Rows = 2
                  
                  2: SELECT * FROM `TEST`
                  Col = string1
                  Col = string2
                  Rows = 2
                  
                  3: DELETE FROM `TEST` WHERE Col LIKE 'string%'
                  Rows = 2
                  

                  根據(jù)您的需要修改我的片段.如果您發(fā)現(xiàn)錯誤,請發(fā)表評論.

                  Modify my snippets per your needs. Leave a comment if you discover a bug.

                  這篇關于嚴格的標準:mysqli_multi_query 的 mysqli_next_result() 錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關文檔推薦

                  store_result() and get_result() in mysql returns false(mysql 中的 store_result() 和 get_result() 返回 false)
                  Call to undefined function mysqli_result::num_rows()(調(diào)用未定義的函數(shù) 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='34K6R'></tbody>
                2. <tfoot id='34K6R'></tfoot>

                      <bdo id='34K6R'></bdo><ul id='34K6R'></ul>

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

                            <small id='34K6R'></small><noframes id='34K6R'>

                          1. 主站蜘蛛池模板: 立式硫化罐-劳保用品硫化罐-厂家直销-山东鑫泰鑫硫化罐厂家 | U拓留学雅思一站式服务中心_留学申请_雅思托福培训 | 注浆压力变送器-高温熔体传感器-矿用压力传感器|ZHYQ朝辉 | 凝胶成像仪,化学发光凝胶成像系统,凝胶成像分析系统-上海培清科技有限公司 | 高铝轻质保温砖_刚玉莫来石砖厂家_轻质耐火砖价格 | 元拓建材集团官方网站| 南汇8424西瓜_南汇玉菇甜瓜-南汇水蜜桃价格 | 代做标书-代写标书-专业标书文件编辑-「深圳卓越创兴公司」 | 睿婕轻钢别墅_钢结构别墅_厂家设计施工报价 | 运动木地板价格,篮球馆体育运动木地板生产厂家_欧氏地板 | 课件导航网_ppt课件_课件模板_课件下载_最新课件资源分享发布平台 | 便携式高压氧舱-微压氧舱-核生化洗消系统-公众洗消站-洗消帐篷-北京利盟救援 | 商用绞肉机-熟肉切片机-冻肉切丁机-猪肉开条机 - 广州市正盈机械设备有限公司 | 西点培训学校_法式西点培训班_西点师培训_西点蛋糕培训-广州烘趣西点烘焙培训学院 | 火锅底料批发-串串香技术培训[川禾川调官网] | 【直乐】河北石家庄脊柱侧弯医院_治疗椎间盘突出哪家医院好_骨科脊柱外科专业医院_治疗抽动症/关节病骨伤权威医院|排行-直乐矫形中医医院 | 化妆品加工厂-化妆品加工-化妆品代加工-面膜加工-广东欧泉生化科技有限公司 | 锂辉石检测仪器,水泥成分快速分析仪-湘潭宇科分析仪器有限公司 | 上海单片机培训|重庆曙海培训分支机构—CortexM3+uC/OS培训班,北京linux培训,Windows驱动开发培训|上海IC版图设计,西安linux培训,北京汽车电子EMC培训,ARM培训,MTK培训,Android培训 | 新疆乌鲁木齐网站建设-乌鲁木齐网站制作设计-新疆远璨网络 | 湖南印刷厂|长沙印刷公司|画册印刷|挂历印刷|台历印刷|杂志印刷-乐成印刷 | 幂简集成 - 品种超全的API接口平台, 一站搜索、试用、集成国内外API接口 | 交通气象站_能见度检测仪_路面状况监测站- 天合环境科技 | 恒温恒湿箱(药品/保健品/食品/半导体/细菌)-兰贝石(北京)科技有限公司 | GAST/BRIWATEC/CINCINNATI/KARL-KLEIN/ZIEHL-ABEGG风机|亚喜科技 | 飞飞影视_热门电影在线观看_影视大全 | 飞利浦LED体育场灯具-吸顶式油站灯-飞利浦LED罩棚灯-佛山嘉耀照明有限公司 | 布袋式除尘器|木工除尘器|螺旋输送机|斗式提升机|刮板输送机|除尘器配件-泊头市德佳环保设备 | 卫生型双针压力表-高温防腐差压表-安徽康泰电气有限公司 | 塑料熔指仪-塑料熔融指数仪-熔体流动速率试验机-广东宏拓仪器科技有限公司 | 氟塑料磁力泵-不锈钢离心泵-耐腐蚀化工泵厂家「皖金泵阀」 | 必胜高考网_全国高考备考和志愿填报信息平台| 锯边机,自动锯边机,双面涂胶机-建业顺达机械有限公司 | 定制/定做冲锋衣厂家/公司-订做/订制冲锋衣价格/费用-北京圣达信 | 517瓜水果特产网|一个专注特产好物的网站 | Q361F全焊接球阀,200X减压稳压阀,ZJHP气动单座调节阀-上海戎钛 | 广州中央空调回收,二手中央空调回收,旧空调回收,制冷设备回收,冷气机组回收公司-广州益夫制冷设备回收公司 | 水质传感器_水质监测站_雨量监测站_水文监测站-山东水境传感科技有限公司 | 南京欧陆电气股份有限公司-风力发电机官网 | 奥运星-汽车性能网评-提供个性化汽车资讯 | 扬子叉车厂家_升降平台_电动搬运车|堆高车-扬子仓储叉车官网 |