Warning: mysql_fetch_array() expects parameter 2 to be long, resource given in www/view.php on line 106能取出数据,就是报警告而已确认数据库的连接正常line 106 就是 $result4=mysql_fetch_array($commentquery,$mylink);然后我把$mylink去掉了之后..就不报警告了...弄了一个下午也没找出个答案来..求解释贴出部分代码<?php
$comment="select * from comment where id_dian='$ID'";
$commentquery=mysql_query($comment,$mylink);
$result4=mysql_fetch_array($commentquery,$mylink);
if($result4=mysql_fetch_array($commentquery))
{
$i=1;
do{
echo $i."楼--".$result4['username'].": ".$result4['comment']."</br>";
$i++;
}
while($result4=mysql_fetch_array($commentquery));
}
else
{
echo "暂无评论,我们期待你的参与";
}
?>
$comment="select * from comment where id_dian='$ID'";
$commentquery=mysql_query($comment,$mylink);
$result4=mysql_fetch_array($commentquery,$mylink);
if($result4=mysql_fetch_array($commentquery))
{
$i=1;
do{
echo $i."楼--".$result4['username'].": ".$result4['comment']."</br>";
$i++;
}
while($result4=mysql_fetch_array($commentquery));
}
else
{
echo "暂无评论,我们期待你的参与";
}
?>
显然你的 $mylink 是个连接句柄变量,当然不对了。
可能的值有常量 MYSQL_ASSOC (1), MYSQL_NUM (2), MYSQL_BOTH(3) 它们都是在mysql扩展加载时定义的
这句去掉后面的$mylink,$commentquery就是结果集了.
第二个参数作用1楼已经解释了
$result4=mysql_fetch_array($commentquery);貌似这种做法少见