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

  • <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="itd88uo" 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() 有什么區(qū)別?

        What is the difference between get_result() and store_result() in php?(php 中的 get_result() 和 store_result() 有什么區(qū)別?)
            <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="q71ft78" 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() 有什么區(qū)別?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

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

                  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() ?

                  推薦答案

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

                  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.

                  差異變得更加明顯,例如,當(dāng)您想要獲取具有給定電子郵件的用戶的 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;  
                      }
                  }
                  

                  如果您希望獲得一個結(jié)果對象,您可以在該對象上調(diào)用 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 獲取結(jié)果對象,而 store_result 則不是這種情況.您現(xiàn)在應(yīng)該從結(jié)果對象中獲取 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.

                  這篇關(guān)于php 中的 get_result() 和 store_result() 有什么區(qū)別?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)
                  Call to undefined function mysqli_result::num_rows()(調(diào)用未定義的函數(shù) mysqli_result::num_rows())
                  PHP Prepared Statement Problems(PHP 準(zhǔn)備好的語句問題)
                  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 中保持其類型?)
                        <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="x37ffkn" id='as6fz'><tfoot id='as6fz'></tfoot><dl id='as6fz'><fieldset id='as6fz'></fieldset></dl></div>

                            主站蜘蛛池模板: 申江储气罐厂家,储气罐批发价格,储气罐规格-上海申江压力容器有限公司(厂) | 走心机厂家,数控走心机-台州博城智能科技有限公司 | 道达尔润滑油-食品级润滑油-道达尔导热油-合成导热油,深圳道达尔代理商合-深圳浩方正大官网 | 鄂泉泵业官网|(杭州、上海、全国畅销)大流量防汛排涝泵-LW立式排污泵 | 中国在职研究生招生信息网 | 中式装修设计_室内中式装修_【云臻轩】中式设计机构 | 球磨机,节能球磨机价格,水泥球磨机厂家,粉煤灰球磨机-吉宏机械制造有限公司 | 钢衬四氟管道_钢衬四氟直管_聚四氟乙烯衬里管件_聚四氟乙烯衬里管道-沧州汇霖管道科技有限公司 | 小型高低温循环试验箱-可程式高低温湿热交变试验箱-东莞市拓德环境测试设备有限公司 | pbootcms网站模板|织梦模板|网站源码|jquery建站特效-html5模板网 | 东莞压铸厂_精密压铸_锌合金压铸_铝合金压铸_压铸件加工_东莞祥宇金属制品 | 华中线缆有限公司-电缆厂|电缆厂家|电线电缆厂家 | 衡阳耐适防护科技有限公司——威仕盾焊接防护用品官网/焊工手套/焊接防护服/皮革防护手套 | 变位机,焊接变位机,焊接变位器,小型变位机,小型焊接变位机-济南上弘机电设备有限公司 | 5nd音乐网|最新流行歌曲|MP3歌曲免费下载|好听的歌|音乐下载 免费听mp3音乐 | 安徽千住锡膏_安徽阿尔法锡膏锡条_安徽唯特偶锡膏_卡夫特胶水-芜湖荣亮电子科技有限公司 | 江苏皓越真空设备有限公司| 快速门厂家批发_PVC快速卷帘门_高速门_高速卷帘门-广州万盛门业 快干水泥|桥梁伸缩缝止水胶|伸缩缝装置生产厂家-广东广航交通科技有限公司 | Copeland/谷轮压缩机,谷轮半封闭压缩机,谷轮涡旋压缩机,型号规格,技术参数,尺寸图片,价格经销商 CTP磁天平|小电容测量仪|阴阳极极化_双液系沸点测定仪|dsj电渗实验装置-南京桑力电子设备厂 | 工业铝型材生产厂家_铝合金型材配件批发精加工定制厂商 - 上海岐易铝业 | 磁力加热搅拌器-多工位|大功率|数显恒温磁力搅拌器-司乐仪器官网 | 风淋室生产厂家报价_传递窗|送风口|臭氧机|FFU-山东盛之源净化设备 | 天津次氯酸钠酸钙溶液-天津氢氧化钠厂家-天津市辅仁化工有限公司 | 无线联网门锁|校园联网门锁|学校智能门锁|公租房智能门锁|保障房管理系统-KEENZY中科易安 | 桂林腻子粉_内墙外墙抗裂砂浆腻子粉推荐广西鑫达涂料厂家供应 | 沈阳庭院景观设计_私家花园_别墅庭院设计_阳台楼顶花园设计施工公司-【沈阳现代时园艺景观工程有限公司】 | 谷歌关键词优化-外贸网站优化-Google SEO小语种推广-思亿欧外贸快车 | 乐考网-银行从业_基金从业资格考试_初级/中级会计报名时间_中级经济师 | 滚珠丝杆升降机_螺旋升降机_丝杠升降机-德迈传动 | CTAB,表面活性剂1631溴型(十六烷基三甲基溴化铵)-上海升纬化工原料有限公司 | 千斤顶,液压千斤顶-力良企业,专业的液压千斤顶制造商,shliliang.com | 广西资质代办_建筑资质代办_南宁资质代办理_新办、增项、升级-正明集团 | 双效节能浓缩器-热回流提取浓缩机组-温州市利宏机械 | 智能化的检漏仪_气密性测试仪_流量测试仪_流阻阻力测试仪_呼吸管快速检漏仪_连接器防水测试仪_车载镜头测试仪_奥图自动化科技 | 驾驶人在线_专业学车门户网站| 压滤机滤板_厢式_隔膜_板框压滤机滤板厂家价格型号材质-大凯环保 | 权威废金属|废塑料|废纸|废铜|废钢价格|再生资源回收行情报价中心-中废网 | 撕碎机_轮胎破碎机_粉碎机_回收生产线厂家_东莞华达机械有限公司 | PCB厂|线路板厂|深圳线路板厂|软硬结合板厂|电路板生产厂家|线路板|深圳电路板厂家|铝基板厂家|深联电路-专业生产PCB研发制造 | 免联考国际MBA_在职MBA报考条件/科目/排名-MBA信息网 | 膜片万向弹性联轴器-冲压铸造模具「沧州昌运模具」 |