dqj5046 2015-04-06 13:44
浏览 33
已采纳

它显示警告:mysql_fetch_array()期望参数1是资源,在[重复]中给出布尔值

<?php       
    $Email = $_SESSION['Email'];
    $query="SELECT Title FROM registerations WHERE Email LIKE $Email";

    //echo $query;
    $res=mysql_query($query);
    //echo $result;
    //$Title="";

    while($row = mysql_fetch_array($res))
    {   //echo "inloop";
            echo $row['Title'];
    }
?>

This is showing the error:

Warning: mysql_fetch_array() expects parameter 1 to be resource, Boolean given in.

I don't understand what the mistake is.

</div>
  • 写回答

1条回答 默认 最新

  • dongtu1357 2015-04-06 13:46
    关注

    Check if the result returns something before fetching it:

    $res=mysql_query($query);
    if($res=== FALSE) { 
        die(mysql_error()); // TODO: better error handling
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 python:excel数据写入多个对应word文档
  • ¥60 全一数分解素因子和素数循环节位数
  • ¥15 ffmpeg如何安装到虚拟环境
  • ¥188 寻找能做王者评分提取的
  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图
  • ¥30 乘子法解约束最优化问题的matlab代码文件,最好有matlab代码文件
  • ¥15 写论文,需要数据支撑
  • ¥15 identifier of an instance of 类 was altered from xx to xx错误
  • ¥100 反编译微信小游戏求指导
  • ¥15 docker模式webrtc-streamer 无法播放公网rtsp