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

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

<legend id='8uFPV'><style id='8uFPV'><dir id='8uFPV'><q id='8uFPV'></q></dir></style></legend>
  • <small id='8uFPV'></small><noframes id='8uFPV'>

      • <bdo id='8uFPV'></bdo><ul id='8uFPV'></ul>
    1. <tfoot id='8uFPV'></tfoot>

        是否可以將 store_result() 和 bind_result() 與 PHP PDO 一

        Is it possible to use store_result() and bind_result() with PHP PDO?(是否可以將 store_result() 和 bind_result() 與 PHP PDO 一起使用?)

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

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

                  本文介紹了是否可以將 store_result() 和 bind_result() 與 PHP PDO 一起使用?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我的問題相當簡單:是否可以將 store_result()bind_result() 與 PHP PDO 一起使用?

                  My question is fairly straightforward: Is it possible to use store_result() and bind_result() with PHP PDO?

                  這是我遇到的一些示例代碼:

                  Here is some example code I came across:

                  $stmt = $mysqli->prepare("SELECT id, username, password, salt FROM members WHERE email = ? LIMIT 1")) { 
                    $stmt->bind_param('s', $email); // Bind "$email" to parameter.
                    $stmt->execute(); // Execute the prepared query.
                    $stmt->store_result();
                    $stmt->bind_result($user_id, $username, $db_password, $salt); // get variables from result.
                    $stmt->fetch();
                  

                  我已經看到這些在 mysqli 的上下文中使用,但沒有在 PHP PDO 中使用.store_result()bind_result() 在 www.php.net 上的 mysqli 中被引用.我很好奇它們是否有效,或者是否有類似的方法.

                  I have seen these used in the context of mysqli, but not with PHP PDO. store_result() and bind_result() are referenced in mysqli on www.php.net. I'm curious if they are valid, or if there are comparable methods.

                  顯然這兩種方法之間有一些轉換.我的假設是 store_resultbind_result() 類似于 PDO 的 fetch() 命令.

                  Obviously there is some translation between the two methods. My assumption is that store_result and bind_result() are similar to PDO's fetch() commands.

                  推薦答案

                  重點是,在 PDO 中既不使用 store_result() 也不使用 bind_result() 絕對沒有意義.
                  只需獲取您的數據并在您希望的任何地方使用它.這就是 PDO 的意義所在.

                  The point is, there is absolutely no point in using neither store_result() nor bind_result() with PDO.
                  Just get your data and use it anywhere you wish. That's the very point of PDO.

                  $sql  = "SELECT id, username, password, salt FROM members WHERE email = ? LIMIT 1";
                  $stmt = $pdo->prepare($sql);
                  $stmt->execute(array($email));
                  $row  = $stmt->fetch();
                  

                  現在您的用戶數據位于 $row 數組中.

                  Now you have your userdata in $row array.

                  將結果行存儲在單獨的變量中現在很少實踐.但是如果你更喜歡這種古老的數據處理方式,你可以添加

                  Storing resulting row in separate variables is very seldom practice nowadays. But if you prefer such ancient way of dealing with data, you could add

                  extract($row);
                  

                  到上面的代碼來獲取你的全局變量.

                  to the above code to get your global variables.

                  mysqli-way 的主要問題是它極難以任何抽象級別使用.

                  The main problem with mysqli-way is that it is extremely hard to use it with whatever level of abstraction.

                  在現實生活中,我們從不全局范圍中調用數據庫,而是在這樣的函數中調用

                  In the real life we never call for database in the global scope, but rather in a function like this

                  function getUserData() {
                      // getting data
                      return $array;
                  }
                  

                  出于某種原因,這個簡單但經常使用的代碼在 mysqli 中變得非常困難!在現實生活中,我們不需要單獨的變量,而是需要返回單個數組.但是對于mysqli,我們需要先獲取這些變量,然后將它們放入數組中,然后才返回它們.簡直瘋了!

                  and for some reason this simple yet mostly used code become extremely difficult with mysqli! In the real life we don't need separate variables but rather single array to be returned. But with mysqli we need to get these variables first, then put them in array and only then return them. Just crazy!

                  這篇關于是否可以將 store_result() 和 bind_result() 與 PHP PDO 一起使用?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='GZbYH'></tbody>
                      • <i id='GZbYH'><tr id='GZbYH'><dt id='GZbYH'><q id='GZbYH'><span id='GZbYH'><b id='GZbYH'><form id='GZbYH'><ins id='GZbYH'></ins><ul id='GZbYH'></ul><sub id='GZbYH'></sub></form><legend id='GZbYH'></legend><bdo id='GZbYH'><pre id='GZbYH'><center id='GZbYH'></center></pre></bdo></b><th id='GZbYH'></th></span></q></dt></tr></i><div class="pbnxtnd" id='GZbYH'><tfoot id='GZbYH'></tfoot><dl id='GZbYH'><fieldset id='GZbYH'></fieldset></dl></div>

                          <tfoot id='GZbYH'></tfoot>
                          <legend id='GZbYH'><style id='GZbYH'><dir id='GZbYH'><q id='GZbYH'></q></dir></style></legend>
                        1. <small id='GZbYH'></small><noframes id='GZbYH'>

                            <bdo id='GZbYH'></bdo><ul id='GZbYH'></ul>
                            主站蜘蛛池模板: 磁力去毛刺机_去毛刺磁力抛光机_磁力光饰机_磁力滚抛机_精密金属零件去毛刺机厂家-冠古科技 | 冷热冲击试验箱_温度冲击试验箱价格_冷热冲击箱排名_林频厂家 | 无机纤维喷涂棉-喷涂棉施工工程-山东华泉建筑工程有限公司▲ | 招商帮-一站式网络营销服务|搜索营销推广|信息流推广|短视视频营销推广|互联网整合营销|网络推广代运营|招商帮企业招商好帮手 | 工业设计,人工智能,体验式3D展示的智能技术交流服务平台-纳金网 J.S.Bach 圣巴赫_高端背景音乐系统_官网 | ★济南领跃标识制作公司★济南标识制作,标牌制作,山东标识制作,济南标牌厂 | 植筋胶-粘钢胶-碳纤维布-碳纤维板-环氧砂浆-加固材料生产厂家-上海巧力建筑科技有限公司 | 微型气象仪_气象传感器_防爆气象传感器-天合传感器大全 | 一体式钢筋扫描仪-楼板测厚仪-裂缝检测仪-泰仕特(北京) | 破碎机锤头_合金耐磨锤头_郑州宇耐机械工程技术有限公司 | 东莞螺杆空压机_永磁变频空压机_节能空压机_空压机工厂批发_深圳螺杆空压机_广州螺杆空压机_东莞空压机_空压机批发_东莞空压机工厂批发_东莞市文颖设备科技有限公司 | 单螺旋速冻机-双螺旋-流态化-隧道式-食品速冻机厂家-广州冰泉制冷 | 水性绝缘漆_凡立水_绝缘漆树脂_环保绝缘漆-深圳维特利环保材料有限公司 | 联系我们老街华纳娱乐公司官网19989979996(客服) | 聚丙烯酰胺_阴离子_阳离子「用量少」巩义亿腾厂家直销,售后无忧 聚合甘油__盐城市飞龙油脂有限公司 | jrs高清nba(无插件)直播-jrs直播低调看直播-jrs直播nba-jrs直播 上海地磅秤|电子地上衡|防爆地磅_上海地磅秤厂家–越衡称重 | 房间温控器|LonWorks|海思| 空气能暖气片,暖气片厂家,山东暖气片,临沂暖气片-临沂永超暖通设备有限公司 | 电竞学校_电子竞技培训学校学院-梦竞未来电竞学校官网 | 不锈钢复合板|钛复合板|金属复合板|南钢集团安徽金元素复合材料有限公司-官网 | 轴流风机-鼓风机-离心风机-散热风扇-罩极电机,生产厂家-首肯电子 | 直读光谱仪,光谱分析仪,手持式光谱仪,碳硫分析仪,创想仪器官网 | 广州云仓代发-昊哥云仓专业电商仓储托管外包代发货服务 | 石膏基自流平砂浆厂家-高强石膏基保温隔声自流平-轻质抹灰石膏粉砂浆批发-永康市汇利建设有限公司 | 真石漆,山东真石漆,真石漆厂家,真石漆价格-山东新佳涂料有限公司 | 掺铥光纤放大器-C/L波段光纤放大器-小信号光纤放大器-合肥脉锐光电技术有限公司 | 北京易通慧公司从事北京网站优化,北京网络推广、网站建设一站式服务商-北京网站优化公司 | SEO网站优化,关键词排名优化,苏州网站推广-江苏森歌网络 | 挤奶设备过滤纸,牛奶过滤纸,挤奶机过滤袋-济南蓝贝尔工贸有限公司 | 手持式浮游菌采样器-全排二级生物安全柜-浙江孚夏医疗科技有限公司 | LED显示屏_LED屏方案设计精准报价专业安装丨四川诺显科技 | BHK汞灯-百科|上海熙浩实业有限公司| 深圳装修_店面装修设计_餐厅设计_装修全包价格-尚泰装饰设计 | 硅PU球场、篮球场地面施工「水性、环保、弹性」硅PU材料生产厂家-广东中星体育公司 | 刚性-柔性防水套管-橡胶伸缩接头-波纹管补偿器-启腾供水材料有限公司 | 土壤养分检测仪_肥料养分检测仪_土壤水分检测仪-山东莱恩德仪器 大型多片锯,圆木多片锯,方木多片锯,板材多片锯-祥富机械有限公司 | led太阳能路灯厂家价格_风光互补庭院灯_农村市政工程路灯-中山华可路灯品牌 | 采暖炉_取暖炉_生物质颗粒锅炉_颗粒壁炉_厂家加盟批发_烟台蓝澳采暖设备有限公司 | 土壤肥料养分速测仪_测土配方施肥仪_土壤养分检测仪-杭州鸣辉科技有限公司 | 彼得逊采泥器-定深式采泥器-电动土壤采样器-土壤样品风干机-常州索奥仪器制造有限公司 | 控显科技 - 工控一体机、工业显示器、工业平板电脑源头厂家 |