Tuesday, February 12, 2019

php - Call to a member function fetch_assoc() on boolean in

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



    

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












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

echo
"




\n";
}
?>


Booking ID: Table No.: No. of Seats: Person:
{$row['id']} {$row['tablename']} {$row['numseats']} {$row['person']}



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.

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...