Answer the question
In order to leave comments, you need to log in
Combine multiple MySQL query results into one
There is a request from server A
$queryA = mysql_query("SELECT * FROM table");
and a request from server B
$queryB = mysql_query("SELECT * FROM table");
The tables are identical, except for the data.
Data from server A is partially (at the beginning) equal to data from server B
Sorted by date.
Need to fetch data from two tables into one mysql_fetch_array
Is this possible?
Answer the question
In order to leave comments, you need to log in
mysql_fetch_array needs a resource, you have two resources, in the end nothing will work for you, array_merge will help you, I think this is the only option. Though I could be wrong =)
There is a problem with setting the task. You can read data from another server using the FEDERATED engine. But you will be upset by the speed.
You can raise master-master replication in mysql. That is, each server will consider itself a slave :). In this case, it remains only to transfer ip in case of problems. The data will be pulled automatically.
>> as a result, the data at the time of the reserve operation is written to it,
if I understand correctly, after the main server rises, you have unique data on the backup server, and hence the need to combine the results arises?
If this is the case, then your problem is not in combining two requests, but in the fact that after restoring the main server, the first thing you need to do is synchronize it with the backup one, and then work only with the main one.
Don't be perverted. You are trying to emulate master-master replication using PHP.
What for? What do you want to guess?
There are two connections, the size of two "fetches" is approximately equal to the size of a "double".
Yes, and it's impossible. As far as I know, it's basically impossible.
1. Nothing, yeptid. This is not Microsoft SQL Server with its SSIS. Suck a skittle, in general.
Or get out with the federated die.
2. About backup, replication, etc. (there was an extension in the comments). mysql has a built-in replication mechanism and it will most likely suit you.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question