PDOStatement 错误的检查结果

PDOStatement wrong result on check

我有这个代码:

$PDOStatement = $pdo->prepare("INSERT INTO users (ID, email, password) VALUES(?, ?, ?)");

    if($PDOStatement->execute($uuid, $email,$encrypted_password))
    {
        echo "test";
        return true;
    }

数据被输入到数据库中,但不幸的是,IF 没有给出回声或 return。

提前致谢!

您需要将参数作为数组传递:

if($PDOStatement->execute($uuid, $email,$encrypted_password))

应该是

if($PDOStatement->execute([$uuid, $email,$encrypted_password]))

(手册:http://php.net/manual/en/pdostatement.execute.php