[thelist] PHP & Database Connection

Max Schwanekamp lists at neptunewebworks.com
Tue Nov 22 16:24:33 CST 2005


Brian Cummiskey wrote:
> j s wrote:
>>I primarily code in asp - but there's a PHP problem on my desk.  In asp you can set up an odbc connection specifying the direct path to the database or a DNS-less connection telling the server to map it for you.  Can you set up a DNS-less connection with PHP?  If so can someone send a typical connection string set for it?
> the real qusetion is what type of database are you trying to connect to??
> odbc w/ php is a little tricky...

In PHP rather than ODBC it's easiest to use an abstraction layer such as 
PEAR::DB, ADODb, etc, which also work with a wide range of database 
types (but with many other advantages over ODBC).  As an ASP user you'd 
probably find ADODb the easiest to grok, but there are countless other 
options to fill that role.  If you're just patching someone else's code 
to connect to you databse, we'll need to know the database type and PHP 
version at a minimum.

-- 
Max Schwanekamp http://www.neptunewebworks.com/



More information about the thelist mailing list