My friend you can query 2 different databases on the same query if:
- The user/pass is the same for the 2 databases
- The 2 databases are on the same server.
Here is an example of the query.
$query ="
SELECT
*
FROM
database1.databaseUser,
database2.databaseFriend
WHERE
database1.databaseUser.uid = database2.databaseFriend.idu
AND database2.databaseFriend.id = '". $_SESSION['uid'] ."'
LIMIT 7
";
You have to include the databasename.table to be able to perform the query.
hope it helps.
This is your full code updated, please make the adjustment for the databases etc.
$query ="
SELECT
*
FROM
database1.databaseUser,
database2.databaseFriend
WHERE
database1.databaseUser.uid = database2.databaseFriend.idu
AND database2.databaseFriend.id = '". $_SESSION['uid'] ."'
LIMIT 7
";
$frnd = $conn->query($query);
while($friend = mysqli_fetch_assoc($sql)){
echo "'.$idu.'";
echo "'.$name.'";
}