Here are three sample ways to connect to a database.  We recomend placing one of the below methods into an include file - a file that contains nothing but the info below and any other database access information so you only have to configure it once, regardless of how many times you use it, or how many pages use it.

Replace the username, password, and database with the information that relates to your specific database before using.

How to access SQL Server from PHP with out a DSN/th>
If you have a SQL Server account with us, it is very easy to access your database from PHP. Here is sample code for establishing a connection to the database:

$server = "database1.ehost-services.com,1433";
$dbusername = "USERNAME"; //database username
$dbpassword = "PASSWORD"; //database password
$dbdatabase = "DATABASE"; //database name
$sqlconnect = @mssql_connect($server, $dbusername, $dbpassword) or die("Couldn't connect to SQL Server on $server");
$sqldb = @mssql_select_db($dbdatabase,$sqlconnect) or die("Couldn't open database $dbdatabase");

How to access SQL Server from PHP WITH a DSN
Every one of our web sites can utilize an MS Access database. You must create the database and upload it to your /Db directory. This is very important- it will not function correctly from any other directory. The /Db directory has special write access that lets you update your database. Here is sample code for establishing a connection to the database:

$dsn="UserDBConn"; //DSN Name
$dbusername = "USERNAME"; //database username
$dbpassword = "PASSWORD"; //database password
$dbdatabase = "DATABASE"; //database name

$sqlconnect = @odbc_connect($dsn, $dbusername, $dbpassword) or die("Couldn't connect to SQL Server using DSN $dsn");
$sqldb = @mssql_select_db($dbdatabase,$sqlconnect) or die("Couldn't open database $dbdatabase");

How to access MySQL Server from PHP
$server="mysqldb1.ehost-services.com";
$dbusername = "USERNAME"; //database username
$dbpassword = "PASSWORD"; //database password
$dbdatabase = "DATABASE"; //database name

$dbc = @mysql_connect ($server, $dbusername, $dbpassword) or die('Counld not connect to Mysql Server:' . mysql_error());
mysql_select_db ($dbdatabase) or die('Could not connect to the database:' . mysql_error());