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

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

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

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

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

        調(diào)用未定義的函數(shù) mysqli_result::num_rows()

        Call to undefined function mysqli_result::num_rows()(調(diào)用未定義的函數(shù) mysqli_result::num_rows())

        <small id='7iAeE'></small><noframes id='7iAeE'>

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

        <legend id='7iAeE'><style id='7iAeE'><dir id='7iAeE'><q id='7iAeE'></q></dir></style></legend>
          <tfoot id='7iAeE'></tfoot>

              <tbody id='7iAeE'></tbody>
                • <bdo id='7iAeE'></bdo><ul id='7iAeE'></ul>

                • 本文介紹了調(diào)用未定義的函數(shù) mysqli_result::num_rows()的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我正在嘗試計算結(jié)果中的行數(shù),但不斷收到上述返回的錯誤.我已經(jīng)檢查了手冊,我正在使用 mysqli_result::num_rows() ,因為我應(yīng)該使用(我使用的是面向?qū)ο蟮娘L(fēng)格.)我在這里工作了三個類.

                  I'm trying to count the number of rows in a result, and I keep getting the above returned error. I've checked the manual, and I'm using mysqli_result::num_rows() as I should be (I'm using object oriented style.) I've got three classes working here.

                  類(連接):

                  class utils_MysqlImprovedConnection {
                      protected $_connection;
                  
                      public function __construct($host, $user, $pwd, $db)
                      {
                          $this->_connection = @new mysqli($host, $user, $pwd, $db);
                          if(mysqli_connect_errno ()) {
                              throw new RuntimeException('Cannot access database:' . mysqli_connect_error());
                          }
                      }
                  
                      public function getResultSet($sql)
                      {
                          $results = new utils_MysqlImprovedResult($sql, $this->_connection);
                          return $results;
                      }
                  
                      public function  __destruct() {
                          $this->_connection;
                      }
                  }
                  

                  類(處理結(jié)果):

                  class utils_MysqlImprovedResult implements Iterator, Countable {
                      protected $_key;
                      protected $_current;
                      protected $_valid;
                      protected $_result;
                  
                  
                      public function  __construct($sql, $connection) {
                         if (!$this->_result = $connection->query($sql)){
                             throw new RuntimeException($connection->error . '. The actual query submitted was: '. $sql);
                         }
                      }
                  
                      public function  rewind()
                      {
                          if (!is_null($this->_key)){
                              $this->_result->data_seek(0);
                          }
                          $this->_current = $this->_result->fetch_assoc();
                          $this->_valid = is_null($this->_current) ? false : true;
                      }
                      public function valid()
                      {
                          return $this->_valid;
                      }
                      public function current()
                      {
                          return $this->_current;
                      }
                      public function key()
                      {
                          return $this->_key;
                      }
                      public function next()
                      {
                          $this->_current = $this->_result->fetch_assoc();
                          $this->_valid = is_null($this->_current) ? false : true;
                          $this->_key++;
                      }
                      public function count()
                      {
                          $this->_result->store_result();
                          $this->_result->num_rows();
                      }
                  }
                  

                  類函數(shù):

                  public function resetPassword($email, $pass){
                      //check if email exists, update authkey and password, send email
                      $sql = "SELECT * FROM table WHERE column = '$email'";
                      $results = $this->_db->getResultSet($sql);
                      if($results->count() == 1){
                          // Process
                          $this->_message = "Success!";
                          return $this->_message;
                      } else {
                          // Not unique
                          $this->_error = "Try again";
                         return $this->_error;
                      } 
                  }
                  

                  我用來調(diào)用所有這些的測試頁面是(包含語句只是工作正常的 __autoload() 函數(shù)):

                  The test page I'm using to call all this is (include statement is just __autoload() function that is working fine):

                  $columnvar = 'emailaddress@test.com';
                  $pass = 'blah';
                  require_once 'inc.init.php';
                  $user = new utils_User();
                  try{
                     $string = $user->resetPassword($email, $pass);
                     echo $string;
                  }
                  catch(Exception $e) {
                     echo $e;
                  }
                  

                  推薦答案

                  從手冊上看,mysqli_result::num_rows 不是一個函數(shù),而是一個包含行數(shù)的變量.

                  From the manual, it seems that mysqli_result::num_rows isn't a function, but rather a variable containing the number of rows.

                  可以這樣使用:

                  $num_rows = $mysqli_result->num_rows;
                  

                  等價的函數(shù)是mysqli_num_rows($result),你在其中傳入mysqli_result對象,但前提是你使用的是過程風(fēng)格而不是面向?qū)ο箫L(fēng)格.

                  The function equivalent is mysqli_num_rows($result), where you pass in the mysqli_result object, but that's if you're using the procedural style rather than object oriented style.

                  在您的代碼中,您應(yīng)該將 utils_MysqlImprovedResult 類中的 count() 函數(shù)更改為如下所示(我假設(shè)這是您獲得的函數(shù))錯誤信息),

                  In your code, you should change your count() function in the utils_MysqlImprovedResult class to be like this (I'm assuming that's the function where you're getting the error message),

                  public function count()
                  {
                      // Any other processing you want
                      // ...
                      return $this->_result->num_rows;
                  }
                  

                  或者如果你想混合 OO 和程序風(fēng)格(可能是個壞主意),

                  or alternatively if you want to mix OO and procedural styles (probably a bad idea),

                  public function count()
                  {
                      // Any other processing you want
                      // ...
                      return mysqli_num_rows($this->_result);
                  }
                  

                  這篇關(guān)于調(diào)用未定義的函數(shù) mysqli_result::num_rows()的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  store_result() and get_result() in mysql returns false(mysql 中的 store_result() 和 get_result() 返回 false)
                  PHP Prepared Statement Problems(PHP 準備好的語句問題)
                  mysqli_fetch_array returning only one result(mysqli_fetch_array 只返回一個結(jié)果)
                  PHP MySQLi Multiple Inserts(PHP MySQLi 多次插入)
                  How do I make sure that values from MySQL keep their type in PHP?(如何確保 MySQL 中的值在 PHP 中保持其類型?)
                  Fatal error: Call to undefined method mysqli::error()(致命錯誤:調(diào)用未定義的方法 mysqli::error())

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

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

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

                            主站蜘蛛池模板: 国产精品久久国产精品99 | 国产精品久久国产精品99 | 免费观看黄 | 国产激情视频 | 国产中文在线 | 三级黄色大片网站 | 亚洲久草视频 | 欧美一区二区三区精品 | www四虎com| 欧美a区 | 国产9 9在线 | 中文 | 精品久久久久久亚洲精品 | 亚洲综合久久网 | 欧美毛片免费观看 | 午夜免费观看网站 | 欧美日韩在线免费观看 | 欧美成人精品一区二区男人看 | 中文字幕一区二区三区在线视频 | 国产精品日韩一区 | 成人小视频在线 | 欧美一级片在线观看 | 精品一区二区三区在线观看 | 国产一区二区三区在线免费观看 | 91精品久久久久久久 | 亚洲精品电影在线 | 中文字幕亚洲一区 | 久久精品国产一区二区三区不卡 | 91亚洲国产成人久久精品网站 | 国产一区二区三区久久久久久久久 | 精品国产一区二区三区性色 | 亚洲女人天堂成人av在线 | 在线欧美小视频 | 夜夜爽99久久国产综合精品女不卡 | 久久国品片 | 欧美三级免费观看 | 羞羞的视频在线 | 亚洲一区二区在线免费观看 | 欧美在线综合 | 亚洲狠狠丁香婷婷综合久久久 | 久久小视频| 日韩精品视频在线播放 |