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

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

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

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

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

    1. <i id='G3rZE'><tr id='G3rZE'><dt id='G3rZE'><q id='G3rZE'><span id='G3rZE'><b id='G3rZE'><form id='G3rZE'><ins id='G3rZE'></ins><ul id='G3rZE'></ul><sub id='G3rZE'></sub></form><legend id='G3rZE'></legend><bdo id='G3rZE'><pre id='G3rZE'><center id='G3rZE'></center></pre></bdo></b><th id='G3rZE'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='G3rZE'><tfoot id='G3rZE'></tfoot><dl id='G3rZE'><fieldset id='G3rZE'></fieldset></dl></div>
      1. 獲取關聯數組時如何消除致命錯誤

        How to remove the fatal error when fetching an assoc array(獲取關聯數組時如何消除致命錯誤)

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

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

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

                • 本文介紹了獲取關聯數組時如何消除致命錯誤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我在我的 php/mysqli 代碼中收到一個致命錯誤,它在第 46 行指出:

                  I am receiving a fatal error in my php/mysqli code which states that on line 46:

                  Fatal error: Call to undefined method mysqli_stmt::fetch_assoc() in ...
                  

                  我只想知道如何消除這個致命錯誤?

                  I just want to know how can I remove this fatal error?

                  它指向的代碼行在這里:

                  The line of code it is pointing at is here:

                  $row = $stmt->fetch_assoc();
                  

                  原始代碼:

                  $query = "SELECT Username, Email FROM User WHERE User = ?";
                  // prepare query
                  $stmt=$mysqli->prepare($query);
                  // You only need to call bind_param once
                  $stmt->bind_param("s",$user);
                  // execute query
                  $stmt->execute(); 
                  // get result and assign variables (prefix with db)
                  $stmt->bind_result($dbUser, $dbEmail);
                  //get number of rows
                  $stmt->store_result();
                  $numrows = $stmt->num_rows();                                      
                  
                  if ($numrows == 1){
                  
                  $row = $stmt->fetch_assoc();
                  $dbemail = $row['Email'];
                  
                  }
                  

                  更新代碼:

                  $query = "SELECT Username, Email FROM User WHERE User = ?";
                  // prepare query
                  $stmt=$mysqli->prepare($query);
                  // You only need to call bind_param once
                  $stmt->bind_param("s",$user);
                  // execute query
                  $stmt->execute(); 
                  // get result and assign variables (prefix with db)
                  $stmt->bind_result($dbUser, $dbEmail);
                  //get number of rows
                  $stmt->store_result();
                  $numrows = $stmt->num_rows();                                      
                  
                  if ($numrows == 1){    
                    $row = $stmt->fetch_assoc();
                    $dbemail = $row['Email'];    
                  }
                  

                  推薦答案

                  變量 $stmt 的類型是 mysqli_stmt,而不是 mysqli_result.mysqli_stmt 類沒有為其定義方法fetch_assoc()".

                  The variable $stmt is of type mysqli_stmt, not mysqli_result. The mysqli_stmt class doesn't have a method "fetch_assoc()" defined for it.

                  您可以通過調用其 get_result() 方法從 mysqli_stmt 對象中獲取 mysqli_result 對象.為此,您需要安裝 mysqlInd 驅動程序

                  You can get a mysqli_result object from your mysqli_stmt object by calling its get_result() method. For this you need the mysqlInd driver installed!

                  $result = $stmt->get_result();
                  row = $result->fetch_assoc();
                  

                  如果您沒有安裝驅動程序,您可以像這樣獲取結果:

                  If you don't have the driver installed you can fetch your results like this:

                  $stmt->bind_result($dbUser, $dbEmail);
                  while ($stmt->fetch()) {
                      printf("%s %s
                  ", $dbUser, $dbEmail);
                  }
                  

                  所以你的代碼應該變成:

                  So your code should become:

                  $query = "SELECT Username, Email FROM User WHERE User = ?";
                  // prepare query
                  $stmt=$mysqli->prepare($query);
                  // You only need to call bind_param once
                  $stmt->bind_param("s",$user);
                  // execute query
                  $stmt->execute(); 
                  // bind variables to result
                  $stmt->bind_result($dbUser, $dbEmail);
                  //fetch the first result row, this pumps the result values in the bound variables
                  if($stmt->fetch()){
                      echo 'result is ' . dbEmail;
                  }
                  

                  這篇關于獲取關聯數組時如何消除致命錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 中保持其類型?)

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

                        <tfoot id='UGQWX'></tfoot>

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

                          • 主站蜘蛛池模板: 欧美日韩国产精品一区 | 国产精品中文字幕在线播放 | 成人综合视频在线观看 | 久久精品这里 | 国产在线视频一区二区 | 日韩免费网站 | 日日操夜夜操天天操 | 亚洲视频免费在线观看 | 亚洲成人一区 | 韩日视频在线观看 | 国产日韩欧美在线观看 | 天天操网 | 91国在线观看 | 中文字幕亚洲一区 | 国产亚洲精品综合一区 | 二区在线观看 | 久久99精品久久 | 国产在线精品一区二区三区 | 日韩在线| 一区二区三区高清 | www亚洲成人| 亚洲国产成人精品一区二区 | 日本一区二区在线视频 | 久久久精品高清 | 成av在线 | 欧美区日韩区 | 欧美群妇大交群中文字幕 | 欧美国产日韩精品 | 亚洲欧美精品在线观看 | 日韩中文字幕2019 | 伊人色综合久久天天五月婷 | 一区二区三区视频免费看 | 人人干人人干人人干 | 欧美成视频 | 午夜天堂精品久久久久 | 在线视频中文字幕 | 亚洲国产一区二区三区在线观看 | 欧美一级全黄 | 久久国产精品免费一区二区三区 | 日本不卡免费新一二三区 | 亚洲精品久久嫩草网站秘色 |