I’m managing a site that’s split up between a domain and subdomain (both hosted by Dreamhost). They use two different databases (let’s call them “www” for the main domain and “blog” for the subdomain), but the same host, username and password.
When I’m in www, I can connect to the database like so:
$databaseConnection = mysql_connect($host, $username, $password, new_link) or die (‘I can’t connect to the database.’);
@mysql_select_db($database,$databaseConnection) or die(“Still Unable to select database”);
When I set $database to the www database, everything works fine. When I try to use the above code when I set $database to the blog database (using the same host, username and password), I get “Still unable to select database”.
This seems like it should be easy - is there a special setting I need to do this with Dreamhost?