Php next()要求参数1为数组,给定布尔值

Php next()要求参数1为数组,给定布尔值,php,mysqli,Php,Mysqli,我正在尝试为我的项目建立一个登录系统,但在登录过程中发生了一个错误。错误为“next()期望参数1为数组,给定布尔值” public function login(Customer $c) { $sql = "select * from customer where username = ? and password = ?"; try { $username = $c -> getUsername(); $

我正在尝试为我的项目建立一个登录系统,但在登录过程中发生了一个错误。错误为“next()期望参数1为数组,给定布尔值”

public function login(Customer $c) {
        $sql = "select * from customer where username = ? and password = ?";

        try {
            $username = $c -> getUsername();
            $password = $c -> getPassword();

            $stmt = $this -> getConnection() -> prepare($sql);
            $stmt -> bind_param('ss', $username, $password);
            $res = $stmt -> execute();

            while (next($res)) {//error occurred on this line
                return true;
            }

        } catch (SQLiteException $ex) {
            echo $ex;
        }

        return false;
    }
execute()在成功时返回true,在失败时返回false

这样使用:

$stmt->execute();
while($row = $stmt->fetch_assoc())
{
    return true;
}
execute()在成功时返回true,在失败时返回false

这样使用:

$stmt->execute();
while($row = $stmt->fetch_assoc())
{
    return true;
}

请参阅文档以查看哪些可能值
$stmt->execute()
可能返回…请参阅文档以查看哪些可能值
$stmt->execute()
可能返回。。。