Jump to content

PHP, MS Access, ODBC: Insert query error


ani_nabo

Recommended Posts

Hello,

I am getting the following error when I am trying to do an insert query when I am using PHP with Access database connected with an ODBC connection:

CODE:

$db= odbc_connect("Access","","");
$query1 = "INSERT INTO TestTable ([LastName]) VALUES ('$LastName')";
$result1=odbc_exec($db,$query1);

ERROR:

Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query., SQL state S1000 in SQLExecDirect

I also tried the following but with no luck:

CODE:
$query1 = "INSERT INTO WebDiamondDUser([LastName]) VALUES (\'$LastName\')";

ERROR:
Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '\'Blackham\''., SQL state 37000 in SQLExecDirect

CODE:
$query1 = "INSERT INTO WebDiamondDUser([LastName]) VALUES ($LastName)";

ERROR:
Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1., SQL state 07001 in SQLExecDirect


Any suggestion???????
Link to comment
https://forums.phpfreaks.com/topic/22909-php-ms-access-odbc-insert-query-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.