小编dho*_*ool的帖子

在<path>中调用boolean上的成员函数fetch_assoc()

我在代码下面运行hte时显示上述错误,以显示从数据库进行的预订.

    <?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> …
Run Code Online (Sandbox Code Playgroud)

html php

17
推荐指数
3
解决办法
9万
查看次数

标签 统计

html ×1

php ×1