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

  • <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="qwawimqqmiuu" id='R9TlY'><tfoot id='R9TlY'></tfoot><dl id='R9TlY'><fieldset id='R9TlY'></fieldset></dl></div>
      3. 在 &lt;path&gt; 中的 boolean 上調用成員函數

        Call to a member function fetch_assoc() on boolean in lt;pathgt;(在 lt;pathgt; 中的 boolean 上調用成員函數 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="qwawimqqmiuu" id='PylYQ'><tfoot id='PylYQ'></tfoot><dl id='PylYQ'><fieldset id='PylYQ'></fieldset></dl></div>
                  本文介紹了在 &lt;path&gt; 中的 boolean 上調用成員函數 fetch_assoc()的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我在運行以下代碼以顯示從數據庫進行的預訂時遇到上述錯誤.

                  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>
                  

                  當我開始實時托管它時,我才開始收到錯誤消息.它在我的個人電腦上運行良好,數據庫連接也運行良好.

                  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 而不是結果集,以防出現錯誤.這就是為什么您會在 fetch_assoc 方法調用中出現錯誤的原因,當 $resultfalse 時,這顯然不存在.

                  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 語句有錯誤.要顯示該錯誤,請執行以下操作:

                  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);
                  

                  很可能您對表名或列名的拼寫有誤.可能在移動到主機時您沒有正確創建該表,并在那里拼寫錯誤.

                  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.

                  實際上,當您通過 phpAdmin 執行相同的查詢時,您應該會看到相同的錯誤.

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

                  你也可以添加這個用于調試:

                  You could also add this for debugging:

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

                  這篇關于在 &lt;path&gt; 中的 boolean 上調用成員函數 fetch_assoc()的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='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="qwawimqqmiuu" 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'>

                            主站蜘蛛池模板: 免费观看av网站 | 亚洲一区二区在线视频 | 国产原创视频 | 成人免费网站视频 | 国产粉嫩尤物极品99综合精品 | 91精品国产综合久久久久久丝袜 | 国产免费xxx| 在线免费观看视频你懂的 | 国产精品美女久久久久久免费 | 国产精品不卡一区 | 日韩国产在线 | 欧美大片一区 | 日韩欧美在线观看一区 | 精品视频亚洲 | 日韩欧美在线不卡 | 日干夜操 | 国产探花在线精品一区二区 | 一区二区三区免费 | 一级a毛片 | 国产成人免费视频网站视频社区 | 欧美精品久久久 | 手机在线观看 | 在线观看免费黄色片 | 福利视频一二区 | 久久久久国产精品一区二区 | 免费看一区二区三区 | 国产成人综合一区二区三区 | 亚洲视频免费在线观看 | 久久久久久亚洲 | 影视先锋av资源噜噜 | 国产成人精品一区二区三区四区 | 久久精品视频免费看 | 综合色播 | 久久视频精品 | 一区二区三区回区在观看免费视频 | 国产精品久久国产精品99 | 日韩视频国产 | 日日操日日舔 | 欧美久 | 日本在线中文 | 欧美在线观看一区 |