I've been using PHP mysqli functions since long but never came accross such a senario where I need to join two tables from different database.
Suppose I've table t1 from database d1 & table t2 from database d2 with a common column say id.
I am stuck here:
mysqli_select_db($conn1,"d1") or die("Error selecting database");
$conn2 = mysqli_connect("localhost","root","") or die("Error connecting Database");
mysqli_select_db($conn2,"d2") or die("Error selecting database");
$sql = "SELECT * from d1.t1 tab1 inner join d2.t2 tab2 on tab1.id = tab2.id";
$result = mysqli_query(**don't know**,$sql);
$row = mysqli_fetch_array($result);
Please tell me what should I write in place of "don't know". Also suggest any better way, if any to get this done.
Thanks in advance.:)