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

  • <tfoot id='jZ9gL'></tfoot>
    <legend id='jZ9gL'><style id='jZ9gL'><dir id='jZ9gL'><q id='jZ9gL'></q></dir></style></legend>

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

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

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

        是否可以將 mysqli_fetch_object 與準備好的語句一起

        Is it possible to use mysqli_fetch_object with a prepared statement(是否可以將 mysqli_fetch_object 與準備好的語句一起使用)

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

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

                  本文介紹了是否可以將 mysqli_fetch_object 與準備好的語句一起使用的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我看到的所有使用 mysqli_fetch_object 的示例都使用 mysql_query(),我無法讓它與準備好的語句一起工作.有誰知道這段代碼有什么問題,因為 fetch_object 返回 null.

                  All the examples I see using mysqli_fetch_object use mysql_query(), I cannot get it to work with prepared statements. Does anyone know what is wrong with this code snippet, as fetch_object returns null.

                  $sql = "select 1 from dual";
                  printf("preparing %s
                  ", $sql);
                  $stmt = $link->prepare($sql);
                  printf("prepare statement %s
                  ", is_null($stmt) ? "is null" : "created");
                  $rc = $stmt->execute();
                  printf("num rows is %d
                  ", $stmt->num_rows);
                  $result = $stmt->result_metadata();
                  printf("result_metadata %s
                  ", is_null($result) ? "is null" : "exists");
                  $rc = $result->fetch_object();
                  printf("fetch object returns %s
                  ", is_null($rc) ? "NULL" : $rc);
                  $stmt->close();
                  

                  輸出為:

                  preparing select 1 from dual
                  prepare statement created
                  num rows is 0
                  result_metadata exists
                  fetch object returns NULL
                  

                  推薦答案

                  我不相信界面是這樣工作的.

                  I don't believe the interface works like that.

                  通過文檔和示例(http://www.php.net/manual/en/mysqli.prepare.php) 似乎 $stmt->execute() 不返回結果集,而是一個指示成功/失敗的布爾值(http://www.php.net/manual/en/mysqli-stmt.execute.php).要實際獲得結果,您需要使用 $stmt->bind_result (http://www.php.net/manual/en/mysqli-stmt.bind-result.php).

                  Going by the documentation and examples (http://www.php.net/manual/en/mysqli.prepare.php) it seems that $stmt->execute() does not return a resultset, but a boolean indicating success / failure (http://www.php.net/manual/en/mysqli-stmt.execute.php). To actually get the result, you need to bind variables to the resultset (aftere the execute call) using $stmt->bind_result (http://www.php.net/manual/en/mysqli-stmt.bind-result.php).

                  完成所有這些之后,您可以重復調用 $stmt->fetch() () 以使用當前行中的列值填充綁定變量.我沒有看到任何提及 $stmt->fetch_object() 的內容,也沒有看到該接口如何與描述的變量綁定方案一起工作.

                  After you did all that, you can do repeated calls to $stmt->fetch() () to fill the bound variables with the column values from the current row. I don't see any mention of $stmt->fetch_object() nor do I see how that interface could work with a variable binding scheme like described.

                  這就是從 mysqli 準備好的語句中獲取正常"結果的故事.

                  So this is the story for "normal" result fetching from mysqli prepared statments.

                  在您的代碼中,我懷疑存在錯誤,或者至少我不確定您是否打算這樣做.你行:

                  In your code, there is something that I suspect is an error, or at least I am not sure you intended to do this. You line:

                  $result = $stmt->result_metadata();
                  

                  將結果集元數據(本身表示為結果集)分配給 $result 變量.根據文檔 (http://www.php.net/manual/en/mysqli-stmt.result-metadata.php) 您只能在這些特殊"類型的結果集上使用方法的一個子集,而 fetch_object() 不是其中之一(至少它是未明確列出).

                  assignes the resultset metadata, which is itself represented as a resultset, to the $result variable. According to the doc (http://www.php.net/manual/en/mysqli-stmt.result-metadata.php) you can only use a subset of the methods on these 'special' kinds of resultsets, and fetch_object() is not one of them (at least it is not explicitly listed).

                  也許是這些元數據結果集沒有實現 fetch_object() 的錯誤,也許你應該在 bugs 提交錯誤.mysql.com 關于那個.

                  Perhaps it is a bug that fetch_object() is not implemented for these metadata resultsets, perhaps you should file a bug at bugs.mysql.com about that.

                  這篇關于是否可以將 mysqli_fetch_object 與準備好的語句一起使用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 中保持其類型?)

                    <bdo id='pU8jc'></bdo><ul id='pU8jc'></ul>

                    1. <tfoot id='pU8jc'></tfoot>
                        <tbody id='pU8jc'></tbody>

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

                    2. <legend id='pU8jc'><style id='pU8jc'><dir id='pU8jc'><q id='pU8jc'></q></dir></style></legend>

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

                            主站蜘蛛池模板: 万濠投影仪_瑞士TRIMOS高度仪_尼康投影仪V12BDC|量子仪器 | 丙烷/液氧/液氮气化器,丙烷/液氧/液氮汽化器-无锡舍勒能源科技有限公司 | 尚为传动-专业高精密蜗轮蜗杆,双导程蜗轮蜗杆,蜗轮蜗杆减速机,蜗杆减速机生产厂家 | 企业微信scrm管理系统_客户关系管理平台_私域流量运营工具_CRM、ERP、OA软件-腾辉网络 | 除甲醛公司-甲醛检测-广西雅居环境科技有限公司 | 油罐车_加油机_加油卷盘_加油机卷盘_罐车人孔盖_各类球阀_海底阀等车用配件厂家-湖北华特专用设备有限公司 | 伊卡洛斯软装首页-电动窗帘,别墅窗帘,定制窗帘,江浙沪1000+别墅窗帘案例 | 单级/双级旋片式真空泵厂家,2xz旋片真空泵-浙江台州求精真空泵有限公司 | pos机办理,智能/扫码/二维码/微信支付宝pos机-北京万汇通宝商贸有限公司 | 塑料异型材_PVC异型材_封边条生产厂家_PC灯罩_防撞扶手_医院扶手价格_东莞市怡美塑胶制品有限公司 | 广州网站建设_小程序开发_番禺网站建设_佛山网站建设_粤联网络 | ◆大型吹塑加工|吹塑加工|吹塑代加工|吹塑加工厂|吹塑设备|滚塑加工|滚塑代加工-莱力奇塑业有限公司 | 品牌策划-品牌设计-济南之式传媒广告有限公司官网-提供品牌整合丨影视创意丨公关活动丨数字营销丨自媒体运营丨数字营销 | 档案密集架_电动密集架_移动密集架_辽宁档案密集架-盛隆柜业厂家现货批发销售价格公道 | 烘箱-工业烘箱-工业电炉-实验室干燥箱 - 苏州华洁烘箱制造有限公司 | 【铜排折弯机,钢丝折弯成型机,汽车发泡钢丝折弯机,线材折弯机厂家,线材成型机,铁线折弯机】贝朗折弯机厂家_东莞市贝朗自动化设备有限公司 | 建筑资质代办_工程施工资质办理_资质代办公司_北京众聚企服 | 网站建设,北京网站建设,北京网站建设公司,网站系统开发,北京网站制作公司,响应式网站,做网站公司,海淀做网站,朝阳做网站,昌平做网站,建站公司 | 截齿|煤截齿|采煤机截齿|掘进机截齿|旋挖截齿-山东卓力截齿厂家报价 | 烟气在线监测系统_烟气在线监测仪_扬尘检测仪_空气质量监测站「山东风途物联网」 | 塑料检查井_双扣聚氯乙烯增强管_双壁波纹管-河南中盈塑料制品有限公司 | 电磁流量计_智能防腐防爆管道式计量表-金湖凯铭仪表有限公司 | 集菌仪厂家_全封闭_封闭式_智能智能集菌仪厂家-上海郓曹 | 特材真空腔体_哈氏合金/镍基合金/纯镍腔体-无锡国德机械制造有限公司 | 外贸网站建设-外贸网站设计制作开发公司-外贸独立站建设【企术】 | 振动传感器,检波器-威海广达勘探仪器有限公司 | 逗网红-抖音网红-快手网红-各大平台网红物品导航 | 上海刑事律师|刑事辩护律师|专业刑事犯罪辩护律师免费咨询-[尤辰荣]金牌上海刑事律师团队 | 冲锋衣滑雪服厂家-冲锋衣定制工厂-滑雪服加工厂-广东睿牛户外(S-GERT) | 医学模型生产厂家-显微手术模拟训练器-仿真手术模拟训练系统-北京医教科技 | 智能楼宇-楼宇自控系统-楼宇智能化-楼宇自动化-三水智能化 | 杭州公司变更法人-代理记账收费价格-公司注销代办_杭州福道财务管理咨询有限公司 | 深圳南财多媒体有限公司介绍 | 专业生物有机肥造粒机,粉状有机肥生产线,槽式翻堆机厂家-郑州华之强重工科技有限公司 | 抓斗式清污机|螺杆式|卷扬式启闭机|底轴驱动钢坝|污水处理闸门-方源水利机械 | 铝镁锰板_铝镁锰合金板_铝镁锰板厂家_铝镁锰金属屋面板_安徽建科 | 玖容气动液压设备有限公司-气液增压缸_压力机_增压机_铆接机_增压器 | 三价铬_环保铬_环保电镀_东莞共盈新材料贸易有限公司 | 玻璃钢罐_玻璃钢储罐_盐酸罐厂家-河北华盛节能设备有限公司 | 深圳彩钢板_彩钢瓦_岩棉板_夹芯板_防火复合彩钢板_长鑫 | 智能监控-安防监控-监控系统安装-弱电工程公司_成都万全电子 |