[英]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.