所以这是我的代码:
<?php
$result = $mysqli->query("SELECT products.name,
categories.name AS 'category',
products.id AS 'prod_id',
FROM products
LEFT JOIN categories
ON products.category = categories.id");
?>
<h1>Products</h1>
<table width="500" cellpadding="5" cellspacing="" border="1">
<tr>
<th>ID#</th>
<th>Product</th>
<th>Category</th>
</tr>
<?php while ($row = $result->fetch_object()): ?>
<tr>
<td><?php echo $row->prod_id;?></td>
<td><?php echo $row->name;?></td>
<td><?php echo $row->category;?></td>
</tr>
<?php endwhile; ?>
</table>
重新加载页面时,我收到此错误消息: “致命错误:在布尔值中调用成员函数fetch_object()...”。
知道可能出现什么问题吗? 在正手感谢!