[英]PDO UPDATE not updating the database
我的更新声明似乎没有更新我的数据库,但我不确定为什么,我在我的脚本中的其他地方使用了相同的代码,它工作正常。
try
{
// update the live documents details
$sth = $conn->prepare("UPDATE docs SET ref = :ref, rev = :rev, updated = :updated WHERE id = :id");
$sth->bindParam(':ref', $ref);
$sth->bindParam(':rev', $rev);
$sth->bindParam(':updated', $date);
$sth->bindParam(':id', $currentid);
$sth->execute();
}
catch(Exception $e)
{
throw new Your_Exception($e->getMessage());
// or
throw $e;
}
我尝试使用PHPMyAdmin手动输入查询到数据库只是为了测试我的表名是否正确,查询是否按预期工作。
UPDATE docs SET ref = 'FMS',
rev = 'D',
updated = NOW( ) WHERE id =73
所以这让我觉得我的PDO语句中有错误。 虽然try catch块没有给出任何错误。
有可能的原因
请验证列出的所有问题。
顺便说一下,为了能够看到抛出的错误,你必须正确配置PHP
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.