Jump to content

insert data from one website to another website


fer0an

Recommended Posts

hello

My database is in a same server with seperate domain name , then I want to insert from website1 mysql data on website2 mysql data.

can anyone help me?

 

It should be no different that a normal database connection within the same domain except for instead of using 'localhost' you use the external host.

Link to comment
Share on other sites

I'm using this codes :

// Connecting, selecting database website 1

$dbuser = "test";
$dbpass = "test";
$dbhost = "localhost";
$dbname = "test";
$con = mysql_connect($dbhost, $dbuser, $dbpass)
   or die('Could not connect: ' . mysql_error());
mysql_select_db($dbname) or die('Could not select database');



// Connecting, selecting database website 2

$dbuser1 = "add";
$dbpass1 = "add";
$dbhost1 = "website2.com";
$dbname1 = "add";
$con1 = mysql_connect($dbhost1, $dbuser1, $dbpass1)
   or die('Could not connect: ' . mysql_error());
mysql_select_db($dbname1) or die('Could not select database');

and I recived an error :

 

Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in /home/.... on line 22

Could not connect:

Link to comment
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.