PDA

View Full Version : Database help...


Crane
02-14-2004, 12:55 AM
I was wondering how do I open a database that is NOT a "local host"? I currently admin a site on another host. I would like to make use of one of my extra DB's that I have with HR in conjuction with other the site.

TomD
02-14-2004, 03:00 AM
The default MySQL connection is on port 3306 so something like the following should work.
<?PHP
$DBUSER = 'UserName';
$DBPASSWORD = 'PassWord';
$DATABASE = 'DatabaseName';
$HOST = 'www.yourdomain.com:3306';

$dbh=mysql_connect ($HOST, $DBUSER, $DBPASSWORD)
or die ('I cannot connect to the database because: ' . mysql_error());

mysql_select_db ($DATABASE);
?>See the HR FAQ (http://support.hostrocket.com/index.php?page=index_v2&id=135&c=15) and double check through a trouble ticket.