/    Sign up×
Community /Pin to ProfileBookmark

[SOLVED]Query through ODBC MS Access

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[/I].

Now I want to [I]update[/I] a table in the DB, but I get an error:

“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]

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);
?>
[/code]

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] something on the DB.

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 ?

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @Kor spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...