这个警告不知道怎么解决mysql_fetch_array() expects parameter 1 to be resource
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /data/multiserv/users/983917/projects/2245004/www/view.php on line 42
本地服务器调试没有出现这个警告,上传到远程服务器就出现了...而且我没有权限修改远程服务器的配置..只能从代码这里来解决
view.php
- HTML code
PHP <?php include("conn.php"); $ID=$_GET['id']; $ID=ceil($ID); $sql="select * from dianpu where id_dian='$ID' and access='1'"; $query=mysql_query($sql,$mylink); $result=mysql_fetch_array($query); ?>
店铺名字 | <?php echo $result['dian_name'];?> |
---|---|
电话 | <?php echo $result['dian_phone']; ?> |
食客评分(0~10) |
<?php $levelsql="select * from comment where id_dian='$ID'"; $query2=mysql_query($levelsql,$mylink); //取出总分 $levelcount="select count(*) as count from comment where id_dian='$ID'"; $levelquery=mysql_query($levelcount,$mylink); $result5=mysql_fetch_array($levelquery); //取出评分人数 $i=0; $zongfen=0; $row=mysql_fetch_array($query2); do { $zongfen=$zongfen+$row['level']; } while($row=mysql_fetch_array($query2)); $level=$zongfen/$result5['count']; echo "平均分: ".$level; echo ""; echo "评分个数:".$result5['count']; ?> |
菜单 |
<?php $sql2="select * from menu where id_dian='$ID' and access='1'"; $result2=mysql_query($sql2,$mylink); $result3=mysql_fetch_array($result2); $i=1; if(!$result3) { echo "暂无菜单"; } else { do { echo $result3['menuname']." ¥".$result3['price']; echo ""; $i++; } while($result3=mysql_fetch_array($result2)) ; } ?>
|
备注 | <?php echo $result['beizhu'];?> |
食客评价 | <?php $comment="select * from comment where id_dian='$ID'"; $commentquery=mysql_query($comment,$mylink); $result4=mysql_fetch_array($commentquery,$mylink); if($result4) { $i=1; do{ echo $i."楼--".$result4['username'].": ".$result4['comment'].""; $i++; } while($result4=mysql_fetch_array($commentquery,$mylink)); } else { echo "暂无评论,我们期待你的参与"; } ?> |
给店家 评分评价 |
上一间 /// 下一间