I’m trying to insert a record using the following code:
if($hasError==0)
{
$time = $_POST['hour'] . ":" . $_POST['minute'];
$sql="INSERT INTO res_tblReservation(resDate,time,numGuests,
email) VALUES('$_POST[date]','$time','$_POST[numPeople]',
'$_POST[email]')";
$qOutput=odbc_exec($conn,$sql) or die(mysql_error());
print "Success!";
}
Execution gets as far as the odbc_exec function before returning the following error:
Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement., SQL state 37000 in SQLExecDirect in D:\Inetpub\dcwebdev\reservationizer\main.php on line 128
I’m sure I’m missing something obvious. Any help would be appreciated.
Edit: I found the answer. The issue was that I had named one of the database columns using a reserved word.