Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/222206-connect-problem/
Share on other sites

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

 

Link to comment
https://forums.phpfreaks.com/topic/222206-connect-problem/#findComment-1149936
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.