Hey guys I have this code:
$tdata = "INSERT INTO insuranceverificationdisclaimer (InsCoName, PhoneNumber, Policy, InsuredName, MailingAdrs, EffDate, ExpDate, Email1, YrVehicle , Make, Model, VIN, TraineeUserName, EmpName, EmpCoName, AgencyNumber, SignDate, AgentName, AgentPhone, AgentEmail , Combinedlimit, bodyinjur ,bodyinjureachacc , propertydmg ) VALUES (':insur',':phone',':policy' ,':insurname',':mailingad',':effdate',':expdate',':email',':yr',':make',':model',':vin',':user',':empname',':empcomp',':agnum',':signdate',':agname',':agphone',':agemail',':csl',':body',':acc',':prop')";
$tinsertdata = $DBH->prepare($tdata);
$tinsertdata->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 ));
But once I hit the execute it will not go forth. The funny thing is this came up out of no where based on if you enter a value into a text field called combined limits which is the Combinedlimits on the database insert. It just blanks the page out and it fails on the execute. I don’t see anything wrong so I don’t know why it is doing this. I checked to see if the field in the database is like the others and it is so I don’t get it.
Combinedlimit is a int(100) with a default of '0' if nothing is entered. Not if you don’t enter anything into that field on the form it works correctly.
here is the input box code for the combinedlimit:
<span class="limitsection">Combined Single Limit for bodily
injury and property damage liability: </span>
<div class="InputInner"> <input type="text"
name="singlelimit" onkeypress="return isNumberKey(event)"
class="combinedinput" value="<?php echo $_SESSION['singlelimit']; ?>">
</div><!----- END .InputInner ---------->
the keypress just only allows the user to enter numbers.
If you can help I would appreciate 🙂
EDIT:
I just recieved this error:
Fatal error: Uncaught exception ‘PDOException’ with message ‘SQLSTATE[HY000]: General error: 1366 Incorrect integer value: ‘:csl’ for column ‘Combinedlimit’ at row 1′ in E:\web\pcgprote\PCG\insert.php:545 Stack trace: #0 E:\web\pcgprote\PCG\insert.php(545): PDOStatement->execute(Array) #1 {main} thrown in E:\web\pcgprote\PCG\insert.php on line 545
There is no need to quote the placeholders inside the prepared statement (i.e. not
':insur', but simply:insur). PDO handles quoting the values.