f6100153 Posted December 20, 2010 Share Posted December 20, 2010 Hi, Im using the following code to connect to database, which is hosted by 1and1. $con = mysql_connect("host.oneandone.co.uk","username","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("database", $con); The code works fine when I use it on the website hosted by 1and1 but I am also trying to get a locally hosted website to connect to it and its giving the following error. Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'host.oneandone.co.uk' (11004) in C:\Site\Engine.php on line 71 Could not connect: The local server can connect to a local database using the same code. Quote Link to comment https://forums.phpfreaks.com/topic/222206-connect-problem/ Share on other sites More sharing options...
Pikachu2000 Posted December 20, 2010 Share Posted December 20, 2010 They probably disallow external connections. Check their faq or call their tech support. Quote Link to comment https://forums.phpfreaks.com/topic/222206-connect-problem/#findComment-1149513 Share on other sites More sharing options...
ZulfadlyAshBurn Posted December 21, 2010 Share Posted December 21, 2010 You will need to have a static ip to make it work. On the client backend, look for Remote Database Access Hosts then insert your static ip. if Remote Database Access Hosts is not there, contact the tech support and ask them to ass your ip to the Remote Database Access Hosts Quote Link to comment https://forums.phpfreaks.com/topic/222206-connect-problem/#findComment-1149936 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.