Help - Connecting to Access Db on win webserver using PHP

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
TGilbert
Forum Newbie
Posts: 1
Joined: Wed Oct 30, 2002 6:40 am
Location: San Antonio, Texas

Help - Connecting to Access Db on win webserver using PHP

Post by TGilbert »

Newbie - need all the help I can get...

Can PHP connect to an Access Database on my webserver? I see some references to Access in the posts. If so, what do I need to setup?

Someone pointed me to a link which described how to setup a DSN
on the webserver, but it was only for MS SQL not Access

I need an working ODBC driver for Access on the webserver

This is what I tried.
1. I used ODBC in the control panel on the webserver to create a System DSN called TESTNEW.
2. I picked the Microsoft Access Database driver.
3. I selected the testnewdb.mdb as the database
4. It says OK and now there is a System DNS called TESTNEW

This is the code but nothing happens...shouldn't it tell me at least whether or not I have successfully connected?
How can I tell?

Code: Select all

<?PHP
    $usr = "root"; 
    $pwd = "door"; 
    $db = "TESTNEW"; 
    $host = "localhost"; 

    # connect to database
    $cid = odbc_connect($host,$usr,$pwd); 
    if (!$cid) &#123; echo("ERROR: " . odbc_error() . "\n");    &#125; 
    else &#123; echo("OK-DOKEY"; &#125;

?>
Access is very good at connecting to other databases using ODBC, but I have not found anything to connect to an Access database.

TIA-TOMG
Post Reply