如何测试以查看以下查询是否成功执行?如何判断查询在PHP PDO中成功执行?
$STH = $this->_db->prepare("UPDATE UserCreds SET
VerificationString=:newVerificationString, ExpiryDate=:expiryDate
WHERE UserID = :userID;");
$STH->execute($params);
我知道我可以使用lastInsertId()
当我加入新行,但什么有关更新并选择?
@Pekka不,我可以得到错误信息就好了。 – 2012-03-01 17:47:11
http://de.php.net/manual/en/pdostatement.execute.php说:*成功返回TRUE或失败时返回FALSE。* - 将其绑定到变量,例如: '$ success = $ STH-> execute($ params);'并检查该变量是否为true或false。 – Quasdunk 2012-03-01 17:47:26