PHP实现查询出错
胡超宇 2019-04-14 07:57:04 <div style="float: none;width: 600px">
<?
$id=isset($_GET["gid"])?$id=$_GET["gid"]:0;
if(!empty($id)){
$sql="select *from goods where goodstypefid=$id or goodstypefstr like '%$id%' and checkinfo=1 and delstate=0";
}else{
$sql="select *from goods";
}
$result=$mysqli->query($sql);
?>
<table>
<tr>
<?php
while($row=$result->fetch_assoc()){
?>
<td>
<image width="200px" height="200px" src="<?php echo $row["picurl"]?>"></image>
<a title="查看商品详细信息" href="goodsshow.php?id=<?php echo $row["id"]?>"><?php echo $row["title"]?></a>
</td>
<?php
}
?>
</tr>
</table>
</div>
错误提示;
Fatal error: Call to a member function fetch_assoc() on a non-object in D:\php\Apache24\htdocs\huchaoyu\goods.php on line 133