I have this simple code to update my record but it failed to update and i waste my more than half hour to identify the problem.
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 ;
}
I were looking this code from last half hour but unable to understand that what was the problem. Sadly PDO didn't provide me the proper error, it was simply returning nothing. Finally i identified that after completetionDateTime
date update value i didn't place comma. I want to ask that why PDO don't provide proper feedback? How to log proper error?