这是我的错误:
警告:odbc_exec():SQL错误:[Microsoft] [ODBC Microsoft Access驱动程序] INSERT INTO语句中的语法错误。,第32行的C:\ xampp \ htdocs \ Fetchrequest.php中的SQLExecDirect中的SQL状态37000
这是我的代码:
<?php
$dbc=odbc_connect('XSG','','');
if (!$dbc) {
exit("Connection Failed: " . $dbc);
}
$fName= $_POST["fName"];
$todayDate= $_POST["todayDate"];
$symptoms= $_POST["symptoms"];
//$chkbox = $_POST['chk'];
$medication = $_POST['medication'];
$numOfSets = $_POST['numOfSets'];
$MedDay = $_POST['MedDay'];
$comment = $_POST['comment'];
echo "Name: $fName <br>";
echo "Date: $todayDate <br>";
echo "Symptoms: $symptoms ";
foreach($medication as $a => $b){
$setCount = $a + 1;
$insertReg1="INSERT INTO MedicalRecords(Name,Date,Symptoms,SetNumber,Medication,MedicationDay,TotalSets,Comments) VALUES ('".$fName."','".$todayDate."','".$symptoms."','".$setCount."','".$medication[$a]."','".$MedDay[$a]."','".$numOfSets[$a]."','".$comment[$a]."')";
$insertR1=odbc_exec($dbc,$insertReg1);
if (!$insertR1) {
exit("Registration Error in SQL.");
}else{
$message ="Successful Registration. Please proceed to the check-in ";
}
odbc_close($dbc);
echo "<h3>Set $setCount </h3>";
echo "Medication: $medication[$a] <br>";
echo "Total Sets: $numOfSets[$a] <br>";
echo "Medication Day: $MedDay[$a] <br>";
echo "Comments: $comment[$a] <br><br>";
}
echo "<a href=addField.html> Add another record</a><br>";
?>