SQL句是没有问题的,测试了,能输出数据来,
但就是报错,不知哪里有问题
<?php $con=mysql_connect('localhost','root','root');//数据库信息mysql_select_db("phpcmsutf8test",$con);//数据库名mysql_query("set names utf8");//设置字符集编码$catidd=$_GET['catid'];echo $catidd;$sql = mysql_query("SELECT jh_comment.title, jh_comment.total, jh_comment.square FROM jh_comment INNER JOIN jh_video ON jh_comment.title = jh_video.title WHERE jh_video.catid = $catidd");$arr = array();while($row = mysql_fetch_assoc($sql,$con)){ $arr[]= $row; }if($arr[0]['total']!=0){ $comtotal=$arr[0]['total']; $comsqu=$arr[0]['square']; $hlu=($comsqu/$comtotal)*100; $hlu=sprintf("%.1f",$hlu).'%'; echo "\$('.comment_lu').html('$hlu');";/ echo "\$('#comment_total').html('$comtotal');";?>
参数多了!
while($row = mysql_fetch_assoc($sql)){