Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in.....
其中 $info = mysqli_fetch_array($sql);为出错的行
代码如下:
<table width="180" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="5"></td>
</tr>
<?php
$sql= mysqli_query($link,"SELECT * FROM `tb_gonggao` ORDER BY time desc limit 0,5");
//按时间顺序查询最新的五条数据
******** $info = mysqli_fetch_array($sql);********
if($info==false){
?>
<tr>
<td height="20" align="center">暂无新闻公告!</td>
</tr>
<?php
}
else{
do{
?>
<tr>
<td height="20"><div align="center">
<table width="180" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="16" height="5"><div align="center"><img src="file:///D|/XAMPP/htdocs/shop/images/circle.gif" width="11" height="12"></div></td>
<td width="164" height="24"><div align="left"> <a href="gonggao.php?id=<?php echo $info['id'];?>">
<?php
echo substr($info['title'],0,25);
if(strlen($info['title'])>25){
echo "...";
}
?>
</a> </div></td>
</tr>
</table>
</div></td>
</tr>
<?php
}
while($info=mysqli_fetch_assoc($sql));
}//调出新闻标题
?>
</table>