在$ query-execute()上获得致命错误;

时间:2017-11-09 21:10:01

标签: php mysql blogs

嗨,我是新编码,我正在关注使用php和mysql构建博客的教程。

这是我的错误

  

致命错误:未捕获错误:调用成员函数execute()   布尔在/homepages/46/d669275675/htdocs/blog/blog.php:5堆栈   跟踪:#0 {main}被抛入   第5行/homepages/46/d669275675/htdocs/blog/blog.php

我的代码看起来像这样

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

0 个答案:

没有答案