Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP connection to an Access .mdb

Status
Not open for further replies.

irbk

MIS
Oct 20, 2004
578
US
Have a site that I'd like to integrate a database into. They are not MySQL friendly. Looks like the only way to get a DB on the site is to have a access .mdb file. I'm looking for help to write the "connection script" for connecting to that access .mdb. I've looked at faq434-829 but that looked more like ASP then PHP to me, then again, I've only ever used MySQL with PHP in the past.
The .mdb file will be in a \database folder that's outside of the \
Thanks for any help!
 
taken from the php manual:

Code:
To connect to a MDB Access file without adding a system dsn to Windows :

$cfg_dsn = "DRIVER=Microsoft Access Driver (*.mdb);
DBQ=C:/Access.mdb;
UserCommitSync=Yes;
Threads=3;
SafeTransactions=0;
PageTimeout=5;
MaxScanRows=8;
MaxBufferSize=2048;
DriverId=281;
DefaultDir=C:/ProgramFiles/CommonFiles/ODBC/DataSources";

$cfg_dsn_login = "";
$cfg_dsn_mdp = "";

odbc_connect($cfg_dsn,$cfg_dsn_login,$cfg_dsn_mdp);

hth. personally i always use a system dsn and the pear db abstraction layer for connection to jet and sql server
 
Dah, I tried looking for this at php.net but didn't see it. I'll give another try searching there for this. I'll need a bit more information on some of the options.

Thanks.
 
Thanks, I found it. Looking at it right now. Just trying to figure out how to translate this to running on my web host. I'm guessing (going off the script above) that "DBQ" won't "=C:" that will be something more like "=../database/content.mdb" The "DefaultDir" is what's really throwing me for a loop.
 
most of the above are parameters. just leave them out and you will revert to defaults.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top