dongzun9958 2014-07-01 15:51
浏览 50
已采纳

MySQLi多个查询,访问第二个数组

I have a multi-query MySQLi statement that uses multiple queries and when using var_dump brings back the following:

var_dump of array:

array(1) { ["company"]=> string(8) "ffr3e456" ["high_1"]=> string(8) "8.32465" }
array(2) { ["company"]=> string(8) "gg8751hw" ["high_2"]=> string(7) "7.66574" }

The code I am using to display the array in a PHP file picks up the first array (i.e. the content of high_1 information but not the second.

code

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);

The HTML output shows the data from the first array but not the second. I am sure I am overlooking something, any advice and feedback welcomed.

  • 写回答

2条回答 默认 最新

  • doucang6914 2014-07-01 16:14
    关注
    $C = array_merge($A, $B);
    

    You can read more here: http://www.php.net/manual/de/function.array-merge.php

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大