I am a bit rusty with my php, but I need to move some code on to a new website and coming upon a lot of problems. This one I can not solvefor the life of me.
I am trying to insert a record into a table which has an auto number as the key. I was not sure if my connection was the problem so I tried the following select first, but it runs withput any problem:
$mySQL = "SELECT * FROM Audit Where AuditID = 1089";
$resNews = $conn->execute($mySQL);
if (!$resNews->EOF)
{
$display = $resNews->Fields['AuditMessage']->Value;
echo $display;
}
Then I attempt an insert:
$sqlAudit = "INSERT INTO Audit (AuditType,AuditCust,AuditMessage) VALUES('LOG','999999','Successful login');
$conn->execute($sqlAudit);
I get the following error
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft OLE DB Provider for ODBC Drivers<br/><b>Description:</b> [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.' in C:\Tardis\Plumbers_Supplies\fValidate.php:246 Stack trace: #0 C:\Tardis\Plumbers_Supplies\fValidate.php(246): com->execute('INSERT INTO Aud...') #1 C:\Tardis\Plumbers_Supplies\fValidate.php(55): GenerateAudit(Object(com), '999999', 'LOG', 'Successful logi...') #2 C:\Tardis\Plumbers_Supplies\Validate_Login.php(8): CheckLogin(Object(com), '999999', 'bill', false, Object(com)) #3 {main} thrown in C:\Tardis\Plumbers_Supplies\fValidate.php on line 246