I have two connection string user DBO:
string1:
try {
$conn1 = new PDO('mysql:host=ip1;dbname=db1','root', '123456');
$conn1->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e) {
echo 'ERROR: ' . $e->getMessage();
}
string2:
try {
$conn2 = new PDO('mysql:host=ip2;dbname=db2','root', '123456');
$conn2->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e) {
echo 'ERROR: ' . $e->getMessage();
}
i using join query for join tb1 to tb2:
$stmt = $conn1->prepare(" select db1.*,db2.col1 from db1 left join db2 on db1.col1=db2.col2");
$stmt -> execute();
$result=$stmt->fetchAll();
if(count($result)){
foreach($result as $row){
echo $row[col1]";
}}
else{
Echo 'Not rows';
}
}
catch(PDOException $e){
echo $e->getMessage();
}
It not work.
i have tried $stmt = $conn1,$conn2-> prepare...
and it not work too. i wrong something?