We have a two database connection, which is given below,
$link1 = mysqli_connect($host1,$user1,$pass1,$db1);
$link2 = mysqli_connect($host2,$user2,$pass2,$db2);
Here, Host and Database are remote.
$query = "SELECT db1_tbl1.name as name,db1_tbl1.email as email ,db2_tbl2.address
as address FROM db1.table1 as db1_tbl1 INNER JOIN db2.tble2 as db2_tbl2 ON
db1_tbl1.std_id = db2_tbl2.std_id WHERE program_id = '$program_id' LIMIT 1,10";
mysqli_query($link1,$query);
If i use $link1 in mysqli_query, the error is showing
SELECT command denied to user 'user_name'@'remote_host_ip' for table 'table_name'
For First Link($link1)
If i use $link2,
SELECT command denied to user 'user_name'@'remote_host_ip' for table 'table_name'
For Second Link($link2)
Normally, separately two remote database connection and retrieving data is ok(it works perfectly)
But the problem is showing when i would like to retrieve data to join two remote host database.
Actually, How can i get data from the query which two connection will work at same time.
How to set the two database connection link in mysqli_query
Pleas any help?