doucong1853 2016-01-20 07:05
浏览 73

警告:mysqli_fetch_array()要求参数1为mysqli_result,在第7行的../中给出布尔值[复制]

I'm having some problems with my website. The domain is bitcointap.xyz. On the /register & /login page. I'm having some PHP errors. On the /register page (bitcointap.xyz/register) I get the error:

"Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in ../ on line 7"

Register.php: http://pastebin.com/4pqvyiL1

Another problem I'm having is with the Login.php page. I get the error;

mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in ../ on line 9

Login.php: http://pastebin.com/ednfCE1y

Any help is greatly appreciated. Thank you.

</div>
  • 写回答

1条回答 默认 最新

  • douzhangli9563 2016-01-20 07:11
    关注

    My guess: the connection failed. The result then will be false (boolean).
    In consequence, mysql_query($con, …) tries to use a connection handle which is false.
    The manual says:

    Returns FALSE on failure. For successful SELECT, SHOW, DESCRIBE or EXPLAIN queries mysqli_query() will return a mysqli_result object. For other successful queries mysqli_query() will return TRUE.

    $con = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
    if ($con===false) {
        echo 'Connection failed (' . $con->connect_errno . '): ' . $con->connect_error;
        exit(1);
    }
    $result = mysqli_query($con, "SELECT * FROM `settings`");
    if ($result===false) {
        echo 'Selection failed :' . $con->error;
        exit(2);
    }
    $settings = mysqli_fetch_array($result);
    // ...
    

    So, you should look at your includes include 'db.php' and include 'dbc.php', which define the connection parameters.

    评论

报告相同问题?

悬赏问题

  • ¥15 ROS Turtlebot3 多机协同自主探索环境时遇到的多机任务分配问题,explore节点
  • ¥15 Matlab怎么求解含参的二重积分?
  • ¥15 苹果手机突然连不上wifi了?
  • ¥15 cgictest.cgi文件无法访问
  • ¥20 删除和修改功能无法调用
  • ¥15 kafka topic 所有分副本数修改
  • ¥15 小程序中fit格式等运动数据文件怎样实现可视化?(包含心率信息))
  • ¥15 如何利用mmdetection3d中的get_flops.py文件计算fcos3d方法的flops?
  • ¥40 串口调试助手打开串口后,keil5的代码就停止了
  • ¥15 电脑最近经常蓝屏,求大家看看哪的问题