Connecting to multiple MySQL servers
Posted: Sun Jun 18, 2006 6:03 pm
Is it possible? I'm creating a script for http://www.tsnhosting.net that will connect to the MySQL server on http://www.turbosaturns.net and read the usernames and passwords from the phpbb database, but at the same time I need to pull information from a local database. Is something like this possible?
Code: Select all
<?php
//Attempts to connect to the local MySQL server
mysql_connect('localhost', 'username', 'password') or die(mysql_error());
mysql_select_db('database') or die(mysql_error());
//Attempts to connect to the remote MySQL server
mysql_connect('remotehost', 'username', 'password') or die(mysql_error());
mysql_select_db('database') or die(mysql_error());
?>