1条回答 默认 最新
- dongpa3109 2019-02-22 22:58关注
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.'"; }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥30 这是哪个作者做的宝宝起名网站
- ¥60 版本过低apk如何修改可以兼容新的安卓系统
- ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
- ¥50 有数据,怎么建立模型求影响全要素生产率的因素
- ¥50 有数据,怎么用matlab求全要素生产率
- ¥15 TI的insta-spin例程
- ¥15 完成下列问题完成下列问题
- ¥15 C#算法问题, 不知道怎么处理这个数据的转换
- ¥15 YoloV5 第三方库的版本对照问题
- ¥15 请完成下列相关问题!