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 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀