我在页面上有一些PHP表单POST用于处理数据并将其存储在AWS上的Postgres RDS中。每次我使用该表格,它对我来说都很好,但我有两个客户告诉我他们的评级丢失了。第二个数据库插入和电子邮件总是很好(据我所知),但第一次插入并不总是有效。
我无法在计算机上使用Chrome或Firefox重现此错误。有人可以推荐一种方法来解决此问题/重现错误和/或推测错误可能是什么?代码如下。
$statement = $db->prepare( "INSERT INTO cleanerrating (cleaner_id, appt_id, user_id, timely, effective, comments) VALUES (:contractor_id, :appt_id, :user_id, :timely, :effective, :comments)");
$statement->execute(array(':contractor_id'=>$arr['contractor_id'][0], ':appt_id'=>$appt_id, ':user_id'=>$user_id, ':timely'=>$timeliness, ':effective'=>$effectiveness, ':comments'=>$comments));
$statement = $db->prepare( "INSERT INTO recur (recur, appt_id, user_id, created) VALUES(:recur, :appt_id, :user_id, 'now')");
$statement->execute(array(':recur'=>$recur, ':appt_id'=>$appt_id, ':user_id'=>$user_id));
if($user_id){
include_once('email.php');
$mail->addAddress('hello@loq-ly.com');
$mail->AddBCC($alertEmail);
$mail->IsHTML(true);
$mail->Subject = "Received user rating for cleaning";
$mail->Body = "We received a rating for cleaner ".$contractor_id." for appointment ".$appt_id." of effectiveness: ".$effectiveness." and timeliness ".$timeliness." with comments: ".$comments."<br><br>Recur value is: ".$recur;
$mail->send();
$mail->ClearAllRecipients();