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

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

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

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

      1. <legend id='DcFVx'><style id='DcFVx'><dir id='DcFVx'><q id='DcFVx'></q></dir></style></legend>

        php 中的 get_result() 和 store_result() 有什么區別?

        What is the difference between get_result() and store_result() in php?(php 中的 get_result() 和 store_result() 有什么區別?)
            <bdo id='kHGxs'></bdo><ul id='kHGxs'></ul>
            <i id='kHGxs'><tr id='kHGxs'><dt id='kHGxs'><q id='kHGxs'><span id='kHGxs'><b id='kHGxs'><form id='kHGxs'><ins id='kHGxs'></ins><ul id='kHGxs'></ul><sub id='kHGxs'></sub></form><legend id='kHGxs'></legend><bdo id='kHGxs'><pre id='kHGxs'><center id='kHGxs'></center></pre></bdo></b><th id='kHGxs'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='kHGxs'><tfoot id='kHGxs'></tfoot><dl id='kHGxs'><fieldset id='kHGxs'></fieldset></dl></div>

              <tbody id='kHGxs'></tbody>

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

                1. <tfoot id='kHGxs'></tfoot>
                  <legend id='kHGxs'><style id='kHGxs'><dir id='kHGxs'><q id='kHGxs'></q></dir></style></legend>
                2. 本文介紹了php 中的 get_result() 和 store_result() 有什么區別?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  這是我的代碼.我正在檢查登錄/注冊系統中是否存在用戶:

                  This is my code. I am checking if a user exists or not in a login/registration system:

                  public function userExist($email){
                      $stmt = $this->conn->prepare("select email from users where email= ?");
                      $stmt->bind_param("s", $email);
                      $stmt->execute();
                      $stmt->store_result();
                      if($stmt->num_rows>0){
                  
                      }
                      else{
                  
                      }
                  }
                  

                  我可以使用 get_result 代替 store_result() 嗎?

                  Can I use get_result instead of store_result() ?

                  推薦答案

                  這取決于您計劃如何讀取結果集.但是在您給出的實際示例中,您對讀取任何返回的數據不感興趣.您唯一感興趣的是是否有記錄.

                  It depends on how you plan to read the result set. But in the actual example you have given, you are not interested in reading any returned data. The only thing that interests you is whether there is a record or not.

                  在那種情況下,您的代碼沒問題,但它與 get_result 一起工作得同樣好.

                  In that case your code is fine, but it would work equally well with get_result.

                  差異變得更加明顯,例如,當您想要獲取具有給定電子郵件的用戶的 userid 時:

                  The difference becomes more apparent, when you want to get for example the userid of the user with the given email:

                  SELECT id FROM users WHERE email = ?
                  

                  如果你打算用 $stmt->fetch 讀出 id,那么你會堅持store_result,并且會使用 bind_result 來定義你想在哪個變量中獲得這個 id,就像這樣:

                  If you plan to read out that id with $stmt->fetch, then you would stick to store_result, and would use bind_result to define in which variable you want to get this id, like this:

                  $stmt->store_result();    
                  $stmt->bind_result($userid);  // number of arguments must match columns in SELECT
                  if($stmt->num_rows > 0) {
                      while ($stmt->fetch()) {
                          echo $userid;  
                      }
                  }
                  

                  如果您希望獲得一個結果對象,您可以在該對象上調用 fetch_assoc() 或任何 fetch_* 變體方法,那么您需要使用 get_result,例如這個:

                  If you prefer to get a result object on which you can call fetch_assoc() or any of the fetch_* variant methods, then you need to use get_result, like this:

                  $result = $stmt->get_result();   // You get a result object now
                  if($result->num_rows > 0) {     // Note: change to $result->...!
                      while ($data = $result->fetch_assoc()) {
                          echo $data['id'];
                      }
                  }
                  

                  請注意,您從 get_result 獲取結果對象,而 store_result 則不是這種情況.您現在應該從結果對象中獲取 num_rows.

                  Note that you get a result object from get_result, which is not the case with store_result. You should get num_rows from that result object now.

                  兩種方式都可以,這真的是個人喜好問題.

                  Both ways work, and it is really a matter of personal preference.

                  這篇關于php 中的 get_result() 和 store_result() 有什么區別?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='as6fz'></tbody>

                        1. <tfoot id='as6fz'></tfoot>
                            <bdo id='as6fz'></bdo><ul id='as6fz'></ul>
                            <legend id='as6fz'><style id='as6fz'><dir id='as6fz'><q id='as6fz'></q></dir></style></legend>

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

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

                            主站蜘蛛池模板: 国产黄色大片 | 精品蜜桃一区二区三区 | 日日夜夜精品视频 | 久久999| 天天草视频 | 国产精品一区二区视频 | 午夜影院在线观看 | 国产精品美女久久久久 | 我要看黄色录像一级片 | 激情国产 | 国产一级在线视频 | 91啪亚洲精品 | 欧美三级在线 | 亚洲一区二区三区在线播放 | 欧美日韩不卡 | 在线观看中文字幕 | 久久久久久亚洲国产精品 | 天天噜天天干 | 福利精品在线观看 | 蜜桃精品视频在线 | 国产黄色在线观看 | 99精品国产一区二区青青牛奶 | 色综合99| 精品久久久久久亚洲精品 | 日本黄色激情视频 | 久久91精品国产一区二区 | 国产高清一区二区三区 | 三级成人在线 | 免费精品视频 | 国产精品久久久99 | 91.色| 欧美亚洲国产日韩 | 性色av一区二区三区 | 久久久久久亚洲精品不卡 | 91精品久久久久久久久中文字幕 | 丁香综合| 天天艹日日干 | 亚洲高清免费观看 | 黑色丝袜三级在线播放 | 毛片在线免费播放 | www亚洲精品 |