0

Hi im new to coding and im following a tutorial on building a blog with php and mysql.

This is my error

Fatal error: Uncaught Error: Call to a member function execute() on boolean in /homepages/46/d669275675/htdocs/blog/blog.php:5 Stack trace: #0 {main} thrown in /homepages/46/d669275675/htdocs/blog/blog.php on line 5

my code looks like this

<?php
// connect to database
include('includes/db_connect.php');
$query = $db->prepare("SELECT post_id, title, LEFT(body, 100) AS body, category 
                       FROM posts 
                       INNER JOIN categories 
                       ON categories.category_id=posts.category_id 
                       order by post_id desc");
$query->execute();
$query->bind_result($post_id, $title, $body, $category);
?>
chris85
  • 23,846
  • 7
  • 34
  • 51
clare
  • 1

0 Answers0