I am trying to connect a MS Access DB, using php via ODBC. The first step: grabbing data from the MDB [I]works great – I can get data and echo it
Now I want to [I]update
“PHP Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query., SQL state S1000 in SQLExecDirect in… [I]file/line
I have checked whether the mdb file is read-only. No, it is not. I have changed all the security file properties to “Full access”, thus I don’t think this is the problem.
Here’s the code I have used:
[code=php]
<?
$conn=odbc_connect(‘mycontent’,”,”);
if (!$conn)
{exit(“Connection Failed: ” . $conn);}
$sql=”UPDATE CV_Pers SET CV_Technique=’foo’ WHERE CV_Nom=’Anghel Monica'”;
odbc_exec($conn,$sql);
odbc_close($conn);
?>
Where:
mycontent – DSN name
CV_Pers – the table’s name
CV_Technique – a column header name
CV_Nom – another column header name
As I said, all these worked OK when I had to retrieve data from DB. But the above code failed when trying to [I]write
I am not quite an ace in php nor ODBC ?. Do you have any idea, please?
Solved. The syntax is ok. Except that the chief programmer forgot to specify the full rights when he set the ODBC ?