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

  • <small id='R9TlY'></small><noframes id='R9TlY'>

      <bdo id='R9TlY'></bdo><ul id='R9TlY'></ul>
    <legend id='R9TlY'><style id='R9TlY'><dir id='R9TlY'><q id='R9TlY'></q></dir></style></legend>

      1. <tfoot id='R9TlY'></tfoot>
      2. <i id='R9TlY'><tr id='R9TlY'><dt id='R9TlY'><q id='R9TlY'><span id='R9TlY'><b id='R9TlY'><form id='R9TlY'><ins id='R9TlY'></ins><ul id='R9TlY'></ul><sub id='R9TlY'></sub></form><legend id='R9TlY'></legend><bdo id='R9TlY'><pre id='R9TlY'><center id='R9TlY'></center></pre></bdo></b><th id='R9TlY'></th></span></q></dt></tr></i><div class="o6waey2" id='R9TlY'><tfoot id='R9TlY'></tfoot><dl id='R9TlY'><fieldset id='R9TlY'></fieldset></dl></div>
      3. 在 &lt;path&gt; 中的 boolean 上調(diào)用成員函數(shù)

        Call to a member function fetch_assoc() on boolean in lt;pathgt;(在 lt;pathgt; 中的 boolean 上調(diào)用成員函數(shù) fetch_assoc())

            <tbody id='PylYQ'></tbody>
          <tfoot id='PylYQ'></tfoot>

        • <small id='PylYQ'></small><noframes id='PylYQ'>

          <legend id='PylYQ'><style id='PylYQ'><dir id='PylYQ'><q id='PylYQ'></q></dir></style></legend>
            <bdo id='PylYQ'></bdo><ul id='PylYQ'></ul>

                  <i id='PylYQ'><tr id='PylYQ'><dt id='PylYQ'><q id='PylYQ'><span id='PylYQ'><b id='PylYQ'><form id='PylYQ'><ins id='PylYQ'></ins><ul id='PylYQ'></ul><sub id='PylYQ'></sub></form><legend id='PylYQ'></legend><bdo id='PylYQ'><pre id='PylYQ'><center id='PylYQ'></center></pre></bdo></b><th id='PylYQ'></th></span></q></dt></tr></i><div class="eokwkss" id='PylYQ'><tfoot id='PylYQ'></tfoot><dl id='PylYQ'><fieldset id='PylYQ'></fieldset></dl></div>
                  本文介紹了在 &lt;path&gt; 中的 boolean 上調(diào)用成員函數(shù) fetch_assoc()的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我在運(yùn)行以下代碼以顯示從數(shù)據(jù)庫(kù)進(jìn)行的預(yù)訂時(shí)遇到上述錯(cuò)誤.

                  I'm getting the above error when running the below code to display bookings made from a database.

                  <?php
                          
                          $servername = "localhost";
                          $username = "*********";
                          $password = "********";
                          $dbname = "thelibr1_fyp";
                  
                  
                          // Create connection
                          $conn = new mysqli($servername, $username, $password, $dbname);
                          // Check connection
                          if ($conn->connect_error) {
                              die("Connection failed: " . $conn->connect_error);
                          } 
                          
                          $sql = "SELECT id, tablename, numseats, person FROM confirms";
                          $result = $conn->query($sql);
                          ?>
                                          
                          <table id="Confirms" border ="2" style="length:900px;width:350px;">
                                <thead>
                                  <tr style= "background-color: #A4A4A4;">
                                    <td>Booking ID:</td>
                                    <td>Table No.:</td>
                                    <td>No. of Seats:</td>
                                    <td>Person:</td>
                                  </tr>
                                </thead>
                              <tbody>
                                  <?php
                                    while(($row = $result->fetch_assoc()) !== null){
                                      echo
                                      "<tr>
                                        <td>{$row['id']}</td>
                                        <td>{$row['tablename']}</td>
                                        <td>{$row['numseats']}</td>
                                        <td>{$row['person']}</td>
                                      </tr>
                  ";
                                    }
                                  ?>
                              </tbody>
                          </table>
                  

                  當(dāng)我開始實(shí)時(shí)托管它時(shí),我才開始收到錯(cuò)誤消息.它在我的個(gè)人電腦上運(yùn)行良好,數(shù)據(jù)庫(kù)連接也運(yùn)行良好.

                  I only started to receive the error when i started hosting it live. It works fine on my personal computer, the databse connection works fine also.

                  推薦答案

                  query 方法可以返回 false 而不是結(jié)果集,以防出現(xiàn)錯(cuò)誤.這就是為什么您會(huì)在 fetch_assoc 方法調(diào)用中出現(xiàn)錯(cuò)誤的原因,當(dāng) $resultfalse 時(shí),這顯然不存在.

                  The query method can return false instead of a result set in case there is an error. That is why you get the error on the fetch_assoc method call, which obviously does not exist when $result is false.

                  這意味著您的 SELECT 語(yǔ)句有錯(cuò)誤.要顯示該錯(cuò)誤,請(qǐng)執(zhí)行以下操作:

                  This means you have an error in your SELECT statement. To get that error displayed, do this:

                   $result = $conn->query($sql) or die($conn->error);
                  

                  很可能您對(duì)表名或列名的拼寫有誤.可能在移動(dòng)到主機(jī)時(shí)您沒有正確創(chuàng)建該表,并在那里拼寫錯(cuò)誤.

                  Most probably you have a wrong spelling for the table name or a column name. Maybe when moving to the host you did not create that table correctly, and made a spelling mistake there.

                  實(shí)際上,當(dāng)您通過 phpAdmin 執(zhí)行相同的查詢時(shí),您應(yīng)該會(huì)看到相同的錯(cuò)誤.

                  You should in fact see the same error when executing the same query via phpAdmin.

                  另外,替換這一行:

                  while(($row = $result->fetch_assoc()) !== null){
                  

                  只要:

                  while($row = $result->fetch_assoc()) {
                  

                  你也可以添加這個(gè)用于調(diào)試:

                  You could also add this for debugging:

                  echo "number of rows: " . $result->num_rows;
                  

                  這篇關(guān)于在 &lt;path&gt; 中的 boolean 上調(diào)用成員函數(shù) fetch_assoc()的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(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)備好的語(yǔ)句問題)
                  mysqli_fetch_array returning only one result(mysqli_fetch_array 只返回一個(gè)結(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='EHy19'></tbody>
                    1. <i id='EHy19'><tr id='EHy19'><dt id='EHy19'><q id='EHy19'><span id='EHy19'><b id='EHy19'><form id='EHy19'><ins id='EHy19'></ins><ul id='EHy19'></ul><sub id='EHy19'></sub></form><legend id='EHy19'></legend><bdo id='EHy19'><pre id='EHy19'><center id='EHy19'></center></pre></bdo></b><th id='EHy19'></th></span></q></dt></tr></i><div class="sosuaa4" id='EHy19'><tfoot id='EHy19'></tfoot><dl id='EHy19'><fieldset id='EHy19'></fieldset></dl></div>
                        <bdo id='EHy19'></bdo><ul id='EHy19'></ul>
                      • <tfoot id='EHy19'></tfoot>

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

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

                            主站蜘蛛池模板: 电动车头盔厂家_赠品头盔_安全帽批发_山东摩托车头盔—临沂承福头盔 | 防水套管-柔性防水套管-刚性防水套管-上海执品管件有限公司 | 工业PH计|工业ph酸度计|在线PH计价格-合肥卓尔仪器仪表有限公司 济南画室培训-美术高考培训-山东艺霖艺术培训画室 | 蜗轮丝杆升降机-螺旋升降机-丝杠升降机厂家-润驰传动 | 带锯机|木工带锯机圆木推台锯|跑车带锯机|河北茂业机械制造有限公司| | 济南轻型钢结构/济南铁艺护栏/济南铁艺大门-济南燕翔铁艺制品有限公司 | 正压密封性测试仪-静态发色仪-导丝头柔软性测试仪-济南恒品机电技术有限公司 | 铣床|万能铣床|立式铣床|数控铣床|山东滕州万友机床有限公司 | 房屋质量检测-厂房抗震鉴定-玻璃幕墙检测-房屋安全鉴定机构 | 淘剧影院_海量最新电视剧,免费高清电影随心观看 | 真石漆,山东真石漆,真石漆厂家,真石漆价格-山东新佳涂料有限公司 | 12cr1mov无缝钢管切割-15crmog无缝钢管切割-40cr无缝钢管切割-42crmo无缝钢管切割-Q345B无缝钢管切割-45#无缝钢管切割 - 聊城宽达钢管有限公司 | 煤机配件厂家_刮板机配件_链轮轴组_河南双志机械设备有限公司 | 郑州外墙清洗_郑州玻璃幕墙清洗_郑州开荒保洁-河南三恒清洗服务有限公司 | 雨水收集系统厂家-雨水收集利用-模块雨水收集池-徐州博智环保科技有限公司 | 高楼航空障碍灯厂家哪家好_航空障碍灯厂家_广州北斗星障碍灯有限公司 | 包头市鑫枫装饰有限公司| 消防泵-XBD单级卧式/立式消防泵-上海塑泉泵阀(集团)有限公司 | 别墅图纸超市|别墅设计图纸|农村房屋设计图|农村自建房|别墅设计图纸及效果图大全 | 臭氧灭菌箱-油桶加热箱-原料桶加热融化烘箱-南京腾阳干燥设备厂 臭氧发生器_臭氧消毒机 - 【同林品牌 实力厂家】 | 大通天成企业资质代办_承装修试电力设施许可证_增值电信业务经营许可证_无人机运营合格证_广播电视节目制作许可证 | 合肥风管加工厂-安徽螺旋/不锈钢风管-通风管道加工厂家-安徽风之范 | 杭州代理记账多少钱-注册公司代办-公司注销流程及费用-杭州福道财务管理咨询有限公司 | 瓶盖扭矩仪(扭力值检测)-百科 | 大功率金属激光焊接机价格_不锈钢汽车配件|光纤自动激光焊接机设备-东莞市正信激光科技有限公司 定制奶茶纸杯_定制豆浆杯_广东纸杯厂_[绿保佳]一家专业生产纸杯碗的厂家 | 网站制作优化_网站SEO推广解决方案-无锡首宸信息科技公司 | 上海三信|ph计|酸度计|电导率仪-艾科仪器 | 临沂招聘网_人才市场_招聘信息_求职招聘找工作请认准【马头商标】 | 山东信蓝建设有限公司官网| 板式换网器_柱式换网器_自动换网器-郑州海科熔体泵有限公司 | 膜结构车棚|上海膜结构车棚|上海车棚厂家|上海膜结构公司 | 温湿度记录纸_圆盘_横河记录纸|霍尼韦尔记录仪-广州汤米斯机电设备有限公司 | 防渗土工膜|污水处理防渗膜|垃圾填埋场防渗膜-泰安佳路通工程材料有限公司 | 桥架-槽式电缆桥架-镀锌桥架-托盘式桥架 - 上海亮族电缆桥架制造有限公司 | 定量包装机,颗粒定量包装机,粉剂定量包装机,背封颗粒包装机,定量灌装机-上海铸衡电子科技有限公司 | 一体化污水处理设备_生活污水处理设备_全自动加药装置厂家-明基环保 | 本安接线盒-本安电路用接线盒-本安分线盒-矿用电话接线盒-JHH生产厂家-宁波龙亿电子科技有限公司 | 网络推广公司_网络营销方案策划_企业网络推广外包平台-上海澜推网络 | 深圳希玛林顺潮眼科医院(官网)│深圳眼科医院│医保定点│香港希玛林顺潮眼科中心连锁品牌 | 楼梯定制_楼梯设计施工厂家_楼梯扶手安装制作-北京凌步楼梯 | 上海道勤塑化有限公司 |