请帮助我,我的剧本中有错误。
致命错误:未捕获的异常' PDOException'消息' SQLSTATE [42000]:语法错误或访问冲突:1065查询为空'在C:\ xampp \ htdocs \ File \ project \ blog \ class \ Blog.php:36堆栈跟踪:#0 C:\ xampp \ htdocs \ File \ project \ blog \ class \ Blog.php(36):PDOStatement- >执行()#1 C:\ xampp \ htdocs \ File \ project \ blog \ index.php(32):Blog-> dataview(NULL)#2 {main}在C:\ xampp \ htdocs \ File中抛出36号线上的\ project \ blog \ class \ Blog.php
public function dataview($query)
{
$stmt = $this->connect->prepare($query);
$stmt->execute();
return true;
if($stmt->rowCount() > 0) {
while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
?>
<tr>
<td><?php print($row['id']); ?></td>
<td><?php print($row['judul']); ?></td>
<td><?php print($row['kategori']); ?></td>
<td><?php print($row['isi']); ?></td>
<td><a href="#"></a></td>
<td><a href="#"></a></td>
</tr>
<?php
}
} else {
?>
<tr>
<td>Not Found</td>
</tr>
<?php
}
}