我需要将这两个数组合并为一个数组。
第一个查询结果
Array ( [0] => stdClass Object ( [p_type] => Bank [tsales] => 131000 [tdues] => 55000 [tpaid] => 75000 ) [1] => stdClass Object ( [p_type] => Cash [tsales] => 104000 [tdues] => 50000 [tpaid] => 54000 ) [2] => stdClass Object ( [p_type] => bKash [tsales] => 25000 [tdues] => 10000 [tpaid] => 5000 ) [3] => stdClass Object ( [p_type] => Pause [tsales] => 4000 [tdues] => 1000 [tpaid] => 2000 ) )
第二个查询结果
Array ( [0] => stdClass Object ( [dpayment] => 1000 ) [1] => stdClass Object ( [dpayment] => 5000 ) [2] => stdClass Object ( [dpayment] => 1000 ) [3] => stdClass Object ( [dpayment] => 5000 ) )
答案 0 :(得分:0)
尝试使用array_merge。这应该很容易。
答案 1 :(得分:0)
您的查询结果显示您使用$ query-> result()来获取值
使用$ query-> row_array();而不是使用result();
然后你得到两个查询的单维数组
然后使用array_merge()
这很容易