I have the personal data (login, password, name, etc.) of the users on a different server than I will use in a new project. I would like to know how I can cross-reference information between two tables, from databases on different servers, with different login credentials as well. I intend to use only the PDO / MySQLi resources to make these connections, since I use shared hosts .
Example of what I wanted, in concept:
SELECT * FROM 'serverLocal'.'banco'.'tabela' INNER JOIN 'serverRemoto'.'banco'.'tabela' ON 'serverLocal'.'banco'.'tabela'.'uniqid' = 'serverRemoto'.'banco'.'tabela'.'uniqid' WHERE 'serverRemoto'.'banco'.'tabela'.'email' = '[email protected]';
In this example, records are related through
uniqid 's that are the same for lines with related content.
I thought about creating a REST API, but I do not know how to use this information in
JOIN , for example. How to make this work? What other solutions would be relevant to solve this problem, and why? Does PDO / MySQLi already have some native functionality so you can "join" two connections to banks on different servers?