我有一个多查询 MySQLi 语句,该语句使用多个查询,并且在使用 var_dump
时返回以下内容:
数组的var_dump:
array(1) { ["company"]=> string(8) "ffr3e456" ["high_1"]=> string(8) "8.32465" }
array(2) { ["company"]=> string(8) "gg8751hw" ["high_2"]=> string(7) "7.66574" }
我用来在 PHP 文件中显示数组的代码会选取第一个数组(即 high_1
信息的内容,但不会选取第二个数组。
代码
if ($mysqli->multi_query($query)) {
do {
/* store first result set */
if ($result = $mysqli->store_result()) {
while ($row = $result->fetch_assoc()) {
for ($p=1; $p<=2; $p++)
{
echo number_format($row["high_".$p],2);
HTML 输出显示第一个数组中的数据,但不显示第二个数组中的数据。我确信我忽略了一些东西,欢迎任何建议和反馈。
最佳答案
$C = array_merge($A, $B);
您可以在这里阅读更多信息:http://www.php.net/manual/de/function.array-merge.php
关于php - MySQLi 多重查询,访问第二个数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24514544/