Connect external database

Using $mcnzconnection = mysql_connect($mcnzhostname,$mcnzusername, $mcnzdbpassword,1) connection fails:

FATAL ERROR: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'xxxxxxxxxxxx' (4)
At line 14 in xxxxxxxxxxxxxxx/mysite/code/partsforsale1.php

partsforsale.php when included by a static page functions fine so is a silverstripe thing.

Note that the connection has its own name $mcnzconnection, and the 4th parameter is used in mysql_connect to indicate a new connection..


On  a hunch, I realise that to test the include I am connecting to a MySQL db on a different godaddy account hosting plan, so if I change partsforsale1.php to connect to a db on the local hosting account I find it connects ok.

Main takeaway:  Godaddy only allows connections to a hosted MySQL DB if it is on the same account. (not sure if runs down to hosting account, and I don't have time to check that Ok, looks like it is across a godaddy account, ie if I have more than 1 hosting plan I can connect to any DB on any hosting plan under the same godaddy account.).