Jump to content


Photo

PHP, MS Access, ODBC: Insert query error


  • Please log in to reply
No replies to this topic

#1 ani_nabo

ani_nabo
  • Members
  • Pip
  • Newbie
  • 1 posts

Posted 03 October 2006 - 07:09 PM

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???????




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users