At the same time execute two server inside two database, this execution statement how to write? Thank you!
Reply to discussion (solution)
Just give the strap a prefix.
The first step: connect to the database, but do not connect to the specific database;
Step two: Precede the table name with a specific database name and use "." Connection.
Why do I have to execute both servers ' databases at the same time? Keep your data unified?
Assuming this is the case, the execution of a database on a server is OK, the other one to do from the database, master and slave hot standby.
Hypothesis only.
Two connections, call two times. No other special.
Yes, what I want to know is why it's so designed ....
1 2lou No. This construct cannot be executed at the same time. It is possible to have two libraries of the same server.
Executes two times mysql_connect, saving the handle separately.
From one database Select, parse the data, and then update to another.
At the same time, switching the database can be done.
Oh, at the same time connecting two databases is actually the same
$con = Mysql_connet ("host_name", "username", "table_name");
$db 1 = mysql_select_db ("Database 1", $con);
$db 2 = mysql_select_db ("Database 2", $con);
$sql = "SELECT * FROM table"
$row 1 = mysql_query ($sql, $db 1);
$sql 2 = "SELECT * FROM Table2"
$row 2 = mysql_query ($sql, $db 2);
It can also be packaged into classes for convenience.