?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?PHP & MS-Access - Insert issue
Author:??(---.blktn1.nsw.optusnet.com.au)
Date:???01-15-04 18:04

I am having trouble with a basic PHP form using MS-Access 2000. I have stared at it for a while now and can't see what is wrong.
The connection works, it is just the sql execution that has issues. I can add info to the data base from an MS-Access form without any issues. I have checked all the names and I can't see any typo's.

I would appreciate some advise here. Thanks.

Output & error message:
-----------------------
|INSERT INTO contacts (givenname, surname, company, email, details) VALUES ('Joe', 'Bloggs', 'Smith & Co', '[email protected]', 'The Quick Brown fox jumped over the lazy dog 1234567890')|
Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query., SQL state S1000 in SQLExecDirect in c:\inetpub\wwwroot\thankyou.php on line 20
An error inserting your data was detected.

Code:
-----
// Connect to database
$connect = odbc_connect("contacts", "", "");

// chect to see if connection was successful
if ($connect) {
// create SQL command
$sql = "";
$sql = $sql."INSERT INTO contacts ";
$sql = $sql."(givenname, surname, company, email, details)";
$sql = $sql." VALUES ";
$sql = $sql."('".$HTTP_POST_VARS[ "given_name" ]."'";
$sql = $sql.", '".$HTTP_POST_VARS[ "surname" ]."'";
$sql = $sql.", '".$HTTP_POST_VARS[ "company" ]."',";
$sql = $sql." '".$HTTP_POST_VARS[ "email" ]."',";
$sql = $sql." '".$HTTP_POST_VARS[ "details" ]."')";
echo "|$sql|";

// execute sql command
$results = odbc_exec($connect, $sql);

// Check to see if sql command was successful
if($results)
echo "Thank you for completing your details.";
else
echo "An error inserting your data was detected.";

// close connection to the database
odbc_close($connect);
} else {
echo "Connection to database failed";
}
?>

?Re: PHP & MS-Access - Insert issue
Author:??(---.ym.rnc.net.cable.rogers.com)
Date:???01-17-04 13:27

You haven't mentioned the platform (I know its windows, but whether Win2K or XP) so here are both solutions..it has to do with file permissions on the folders

win 2000

For those of us using NTFS on our servers along with IIS and Access, the anonymous web user account (IUSR_Computername) must have write permissions (NTFS not IIS) to the database file itself. As soon as I changed mine, the thing just flew through the installation like it should have in the first place

XP

Actually XP requires an extra step you have to enable the security tab before you can set permissions - go to tools>folder options, click the view tab, scroll all the way to the bottom and uncheck Use simple file sharing (Recommended). Voila! Security tab Then just right-click your filename, choose properties, security tab, add, type in IUSR_YourComputerName, click OK, then check off modify. Hit OK and run the install again.

hth

?Re: PHP & MS-Access - Insert issue
Author:??(4.10.134.---)
Date:???01-28-04 10:29

When try writing form data to a text file in XP, I get the error
"403 Forbbiden You don't have permission to access /phpApp/add_File.php" on this serve.

I'm not sure where I click on tools from. I went the phpAPP directory and clicked on tools>folder options. I don't see the
"Use simple file sharing" option to uncheck.

Is there somewhere else I should be starting from, before I click on Tool> etc?

?Re: PHP & MS-Access - Insert issue
Author:??(4.10.134.---)
Date:???01-28-04 14:31

I figured it out.
It was as plain as day. I was missing a quote.
Thank you

Go to Top??|??Go to Topic??|??Threaded View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??

Provided By
Phorum