php - 合并/合并两个 mysqli_fetch_assoc 数组
问题描述
我有来自 mysqli_fetch_assoc 的 2 个数组,来自 2 个不同服务器的 2 个不同数据库。我的主要辅助服务器被我的办公室联合禁用和 root 禁用所以我决定通过 php fetch assoc 调用手动 .. 这是我在表中的结果
NO. USERID USERNAME USERSTATUS other NAME
1 1 daffa 1 2 Sugeng
2 2 meito 1 4 Sugeng lagi
不。USERID USERNAME USERSTATUS 行来自 $new_array1 其他 NAME 来自 $new_array2
那么这是我的代码
$i = 1;
while(($new_array1 = mysqli_fetch_assoc( $result1)) && ($new_array2 = mysqli_fetch_assoc( $result2))){
echo '
<tr>
<td>'.$i.'</td>
<td>'.$new_array1['userid'].'</td>
<td>'.$new_array1['username'].'</td>
<td>'.$new_array1['userstatus'].'</td>
<td>'.$new_array2['other'].'</td>
<td>'.$new_array2['NAME'].'</td>
</tr>
';
$i++;
}
但是还有 2 个数组,如何从 fetch assoc 中合并 2 个数组?我想让它成为单个数组,然后显示数据
解决方案
推荐阅读
- c++ - 可序列化对象与谷物
- nginx - 将 https://www.subdomain.example.com 重定向到 https://subdomain.example.com(删除 www)
- c# - 如何发布这个依赖 Nuget 的 C# 源代码生成器?
- node.js - 运行“npm run start-dev”时 Hyper 出错(尝试在没有解决方案代码的情况下打开项目)
- html - CSS DIV 和 span 优先级
- bnf - Purescript 是否有可用的 BNF 类型语法?
- api - 从 Google Api 中删除“$”
- flutter-web - 如何在每个页面上都有一个导航栏 Flutter Web
- c# - 循环遍历一个大数组并将值加在一起 C#
- javascript - 如何使用 Jasmine 和 Angular 模拟嵌套函数