471,887 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,887 software developers and data experts.

Access Database - Insert - Auto Number

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');

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
Nov 30 '07 #1
2 2594
157 100+
I would start by checking what the permissions are. It could be that you have read permissions on the database and not write permissions.
Dec 1 '07 #2
Thank you - that was my problem!
Dec 3 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Sims | last post: by
14 posts views Thread by Sean C. | last post: by
49 posts views Thread by Yannick Turgeon | last post: by
10 posts views Thread by Jay | last post: by
4 posts views Thread by so many sites so little time | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.