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>\n"; } ?> </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.