我有这个简单的代码来更新我的记录,但它无法更新,我浪费了半个多小时来确定问题。
global $connPDO;
date_default_timezone_set("Asia/Karachi");
$sql = "UPDATE `emp_task_assign_completion`
SET completetionDateTime = '".date("Y-m-d H:i:s")."'
`TaskStatusMainId` = :taskStatusMainId,
`TaskStatusDetailId` = :taskStatusDetailId
WHERE taskAssignCompletionId = :empTaskAssignCompletionId";
echo $sql;
$queryInsert = $connPDO->prepare($sql);
$binds = array(
':taskStatusMainId' => $taskStatusMainId,
':taskStatusDetailId' => $taskStatusDetailId,
':empTaskAssignCompletionId' => $empTaskAssignCompletionId
);
$querySuccess = $queryInsert->execute($binds);
if($querySuccess ==1){
echo "Successfully Task Status Updated";
}else{
echo "The Request has accepted but Task status changed has failed, contact administrator. Error is:".$querySuccess ;
}
我从最后半小时看这段代码,但无法理解问题是什么。可悲的是,PDO并没有向我提供正确的错误,它只是没有返回任何内容。最后,我确定在completetionDateTime
日期更新后,我没有逗号。我想问一下为什么PDO没有提供适当的反馈?如何记录正确的错误?