• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

这个警告不知道如何解决mysql_fetch_array() expects parameter 1 to be resource

php 搞代码 3年前 (2022-01-24) 18次浏览 已收录 0个评论

这个警告不知道怎么解决mysql_fetch_array() expects parameter 1 to be resource
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /data/multiserv/users/983917/projects/2245004/www/view.php on line 42

本地服务器调试没有出现这个警告,上传到远程服务器就出现了…而且我没有权限修改远程服务器的配置..只能从代码这里来解决

view.php

HTML code

<!---ecms Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> PHP<?phpinclude("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" 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">        <?phpecho $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>      <label for="textfield"></label>      <div align="center">        <p>          <label for="name"></label>          昵称                  </p>        <p>评论          <textarea name="pinglun" rows="5" id="pinglun"></textarea>        </p>        <p>          <label for="level"></label>          <label for="level">分数</label>                      1            2            3            4            5            6            7            8            9            <strong>*本文来@源gao@daima#com搞(%代@#码@网2</strong><pre>搞代gaodaima码

10 分 ” id=”pinglun”>

“>上一间 /// “>下一间


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:这个警告不知道如何解决mysql_fetch_array() expects parameter 1 to be resource
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址