I am developing a php app based on MySQL. I connect to the first database with
$conn1 = mysqli_connect("127.0.0.1", "root", "password", "db1");
and then perform a query. How can I do the JOIN if table1 and table2 are located in 2 different databases (exemple $conn1 and $conn2) ?
$stmt = $conn1->prepare("SELECT a.var1, a.var2, a.var3, ...
FROM table1 a
JOIN table2 b //this is located on $conn2
ON a.var1 = b.var7