PDO更新有问题

时间:2012-10-22 17:24:08

标签: php pdo

我正在使用PDO的更新功能更新表单。由于某种原因,它没有经历。

这是代码:

$data = "UPDATE insuranceverificationdisclaimer SET InsCoName =:insur, PhoneNumber = :phone, Policy = :policy, InsuredName = :insurname
, MailingAdrs = :mailingad, EffDate = :effdate, ExpDate = :expdate, Email1 = :email, YrVehicle = :yr, Make = :make
, Model = :model, VIN = :vin, TraineeUserName = :user, EmpName = :empname, EmpCoName = :empcomp, AgencyNumber = :agnum
, SignDate = :signdate, AgentName = :agname, AgentPhone = :agphone, AgentEmail = :agemail, Combinedlimit = :csl, bodyinjur = :body
, bodyinjureachacc = :acc
, propertydmg = :prop WHERE TraineeUsername = :user";
        echo"1";

$insertdata = $DBH->prepare($data);
$insertdata->execute(array(':insur' => $compname, ':phone' => $phone , ':policy' => $policynum, ':insurname' => $nameofPolicyholder
, ':mailingad' => $newMailingAdrs, ':effdate' => $Policyeffdate, ':expdate' => $Policyexpdate, ':email' => $newEmployeeEmail
, ':yr' => $YearOfVehicle, ':make' => $MakeOfVehicle, ':model' => $ModelOfVehicle, ':vin' => $Vehicleid, ':user' => $username, ':empname' => $EmployeeName, ':empcomp' => $EmployeeCompanyName, ':agnum' => $Agencynum
, ':signdate' => $TodaysDate, ':agname' => $agentname, ':agphone' => $agentphone, ':agemail' => $agentemail, ':csl' => $singlelimit
, ':body' => $bodyinjur, ':acc' => $eachacc, ':prop' => $propertydmg ));

, ':csl' => $singlelimit, ':body' => $bodyinjur, ':acc' => $eachacc, ':prop' => $propertydmg开始时这是不起作用的函数,这些是数据库中的整数,值是整数。如果我从select和数组中删除它将工作但除此之外它不会。

如果您还有其他需要,请告诉我们!

UDATED ---------------------------

一旦你点击执行页面就不会经历白色。

1 个答案:

答案 0 :(得分:0)

您应该按照Michael Berkowski的建议开启错误报告。现在我只能假设错误是由未定义的params数据类型引起的。您可以尝试以下方法:

$insertdata->bindParam(':insur', $compname, PDO::PARAM_STR);
$insertdata->bindParam(':csl', $singlelimit, PDO::PARAM_INT);
//...bind the other params 
$insertdata->execute();