I am having some trouble with a left join in a simple blog script I am writing to go with my basic CMS.
$result = $dbc->prepare("SELECT blog.id, blog.title, blog.post, blog.date, blog.time, comments.blogid FROM blog LEFT JOIN comments ON blog.id = comments.blogid ORDER BY id DESC LIMIT $start_blog, $blog_per_page");
$result->execute();
$result->bind_result($id, $title, $post, $date, $time, $blogid);
The above code is returning the following error: Fatal error: Call to a member function execute() on a non-object in C:\xampp\htdocs\pcms\includes\blog.php on line 56 (with line 56 being $result ->execute();)
I just cant see what is causing the error, if I remove the LEFT JOIN the SQL code is working fine.