Hello
I am wanting to copy all data from one table to another.
I am using PHP and MySQL
I have done this with tables that in the the same database,
but is it possible to do this with tables that are run by different
virtual servers ?
So I want to quickly build a new table on QR-KUPONS from MOBI6
This is my "usual" backup script.
When I have wanted to access a different server in the past I
have logged on as that user on the database ... like this.
I am not sure how I would combine these two so I can quickly build a new
table on QR-KUPONS from MOBI6
I should say, that the databases are on the same physical server and use the same MySQL
database.
Any thoughts ?
Thanks.
I am wanting to copy all data from one table to another.
I am using PHP and MySQL
I have done this with tables that in the the same database,
but is it possible to do this with tables that are run by different
virtual servers ?
So I want to quickly build a new table on QR-KUPONS from MOBI6
This is my "usual" backup script.
Code:
$sql = "DROP TABLE IF EXISTS `pages_backup`";
$result = mysql_query($sql)
or die("could not DROP pages_backup.". mysql_error());
echo "DROPPED pages_backup Table <br>";
$sql = "CREATE TABLE `pages_backup` LIKE `pages`";
$result = mysql_query($sql) or write_error("Could not CREATE TABLE pages_backup.".mysql_error()."\r\n");
$sql = "INSERT INTO `pages_backup` SELECT * FROM `pages`";
$result = mysql_query($sql) or write_error("Could not INSERT INTO pages_backup.".mysql_error()."\r\n");
echo "COMPLETED BACK UP OF PAGES<br>";
have logged on as that user on the database ... like this.
Code:
// CHANGE SERVER TO: MOBI6
$host = "localhost";
$user = "mobi677d";
$password = "xxx password xxx";
$database = "mobi677d";
$connection = mysql_connect($host,$user,$password) or die ("Couldn't connect to server.");
$db = mysql_select_db($database, $connection) or die ("Couldn't select database.");
do my stuff, then back again.
// CHANGE BACK TO SERVER : QR-KUPONS
$host = "localhost";
$user = "kup823";
$password ="xxx password xxx";
$database = "kup823";
$connection = mysql_connect($host,$user,$password) or die ("Couldn't connect to server.");
$db = mysql_select_db($database, $connection) or die ("Couldn't select database.");
table on QR-KUPONS from MOBI6
I should say, that the databases are on the same physical server and use the same MySQL
database.
Any thoughts ?
Thanks.