Jump to content

PHP ADO not working


jimneely

Recommended Posts

I am having problems getting the example in the w3Schools php database for ADO to work. neither example is working for me. I have installed the two database in C:WebData and the code in my C:WEB. When I run either program I get the HTML H1 "Customer" along with the php code itself on my browser. I have changed the security to allow anyone to access the database. I can open the database directly. Can someone please help me. Could this be a timeout issue?

 

 

Here is my modified code to see what's wrong. This does not work either.

<? php

echo "Testing";

$conn = new COM("ADODB.Connection");

$conn ->open("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:WebDataNorthwind.mdb");

echo "Connected to Database";

?>

Edited by jimneely
Link to comment
Share on other sites

If you're seeing the PHP code in the browser then the web server is not executing the PHP. Make sure that your file is saved as a .php file and that PHP is installed and configured on the web server.

Link to comment
Share on other sites

I enable error reporting and found Fatal Error. Error is "It is already open by another user or you need permission to view the data. I can access the DB on my local machine but not the server. I can manually access the DB on the server as well as the local machine.

Link to comment
Share on other sites

The web server accesses files under a different user account, you might need to give that account access to the files. I'm not sure if it has changed, but the account that IIS used to run under is called IUSR_<server name>.https://www.google.com/search?client=opera&q=iis+user+account&sourceid=opera&ie=UTF-8&oe=UTF-8The error message also indicates that you might just have the database open with Access. If you have the database open, then close it before trying to run the PHP page.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...