简体   繁体   English

PDOStatement检查错误结果

[英]PDOStatement wrong result on check

I am having this code: 我有此代码:

 $PDOStatement = $pdo->prepare("INSERT INTO users (ID, email, password) VALUES(?, ?, ?)"); if($PDOStatement->execute($uuid, $email,$encrypted_password)) { echo "test"; return true; } 

The data gets entered into the DB, but unforunetly the IF is not giving out the echo or the return. 数据被输入到DB中,但是不幸的是,IF没有发出回声或返回。

Thanks in advance! 提前致谢!

You need to pass the parameters as an array: 您需要将参数作为数组传递:

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

should be 应该

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PDOStatement PHP MSSQL选择是否结果? - PDOStatement PHP MSSQL Select if result? 调用未定义的方法PDOStatement :: bind_result()? - Call to undefined method PDOStatement::bind_result()? 找不到PDOStatement :: Execute = /的错误 - Can't find what's wrong with PDOStatement::Execute =/ 该PDO语句有什么问题? 无法将PDOStatement类型的对象用作数组 - What is wrong with this PDO statement? Cannot use object of type PDOStatement as array 收到错误“调用未定义的方法PDOStatement :: store_result()” - Getting the error 'Call to undefined method PDOStatement::store_result()' 如何确定是否存在(不)PDOStatement提取的结果? - How can I simply determine if there is (not) a result from PDOStatement fetch? 在PDO :: commit之后使用PDOStatement :: rowCount结果? - PDOStatement::rowCount result when used after PDO::commit? 为什么我需要带有存储过程的PDOStatement :: nextRowSet才能获得结果? - Why I need PDOStatement::nextRowSet with stored procedure to get result? 始终检查PDOStatement :: execute的返回值是否是最佳实践? - Is it best practice to always check the return value of PDOStatement::execute? 是否有可能检查pdostatement :: fetch()是否有结果而不迭代一行? - Is it possible to check if pdostatement::fetch() has results without iterating through a row?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM