Home >Backend Development >PHP Tutorial >这样写的sql哪里有问题呢

这样写的sql哪里有问题呢

WBOY
WBOYOriginal
2016-06-23 13:41:27723browse

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)){

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn