和mysql_fetch_array()结上的不解之缘.

WBOY
Release: 2016-06-13 13:12:06
Original
733 people have browsed it

和mysql_fetch_array()结下的不解之缘.....
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 code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?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 "暂无评论,我们期待你的参与";
          
          }
    ?>

Copy after login


------解决方案--------------------
第二个参数是决定返回数组的类型,可能的值有: MYSQL_ASSOC, MYSQL_NUM, and MYSQL_BOTH.
显然你的 $mylink 是个连接句柄变量,当然不对了。
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template