How do I connect to MySQL with PHP remotely?

Here's my situation. I got one site up that has a mysql database, works fine... Now I purchased a new domain name and am trying to use the same database for the new site. Any idea's on what the host would be?

For my other site I use
$host = "localhost";

But that doesn't seem to work any ideas on what would work?
 
You will have to use the FQDN, eg:

$db = mysql_connect("example.com","usename","password");
$dbname = "db name";

Some hosts do not allow you to connect from a remote site, the site has to be on the same server of hosting company. Check CPanel and see if it's even available.
 
Back
Top