日期:2014-05-17 浏览次数:20591 次
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); ?> <title></title> <table width="891" height="387" border="1" align="center"> <tr> <th scope="col">店铺名字</th> <th width="787" scope="col"><?php echo $result['dian_name'];?></th> </tr> <tr> <td width="88"><div align="center">电话</div></td> <td> <div align="center"> <?php echo $result['dian_phone']; ?> </div></td> </tr> <tr> <td><div align="center"> <p>食客评分(0~10) </p> </div></td> <td><div align="center"><?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 "</br>"; echo "评分个数:".$result5['count']; ?></div></td> </tr> <tr> <td><div align="center">菜单</div></td> <td><p align="center"> <?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 "</br>"; $i++; } while($result3=mysql_fetch_array($result2)) ; } ?> </p> <p> </p></td> </tr> <tr> <td><div align="center">备注</div></td> <td><div align="center"><?php echo $result['beizhu'];?></div></td> </tr> <tr> <td><div align="center">食客评价</div></td> <td><div align="left"> <?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']."</br>"; $i++; } while($result4=mysql_fetch_array($commentquery,$mylink)); } else { echo "暂无评论,我们期待你的参与"; } ?> </div></td> </tr> <tr> <td><div align="center"> <p>给店家</p> <p>评分评价</p> </div></td> <td><form name="form1" method="post" action="comment.php"> <label for=