mysqli_fetch_assoc()期望参数1为mysqli_result boolean given

时间:2018-06-05 20:26:55

标签: php mysql warnings

我不明白......为什么在这里警告?我检查了数据库,一切看起来都不错......有人可以帮助我做错了什么......

<?php
    include_once('connection.php');
    $sql = "SELECT username, foodlimit FROM users";
    $result = mysqli_query($conn, $sql);
    while($Red = mysqli_fetch_assoc($result))
    {
        $username = $Red['username'];
        $foodlimit = $Red['foodlimit'];
        $foodlimit = $foodlimit + 1;

        $sql = "UPDATE users SET foodlimit = '$foodlimit' WHERE username = '$username'";
        $result = mysqli_query($conn, $sql);

    }
?>

编辑#1:我尝试了所有我在stackoverflow上找到的东西,没有什么事情无法帮助我......

0 个答案:

没有答案