Hi there everyone!
First, off, I am having a problem adding to an array key: I'm trying to use array_push, but it's adding to a new key.
There's two queries, one dependent on a condition of the previous. I create an array from the primary $row and then during the subsequent $row, I'm trying to add to the array, without starting a new primary key. So I would like to add $row_ci2 to $cart_items[0] if that's the key that $row_ci had just populated.
What I'm doing:
array_push($cart_items, $row_ci2);
What I'd like:
[0] => Array
(
[id] => 1
[title] => Pro Comp Series 5034 Rockwell Satin Black Rim 5 x 5 17 x 8.5
[short_title] => Rockwell Satin Black Rim
[price] => 157.00
[shipping] => 0.00
[quantity] => 0
[quantity_sold] => 0
[category] => 1
[brand] => 1
[model] => 1
[mpn] => PXA5034-78573
[citype] => wheel
[added] => 1459958500
[lastupdate] => 1461074302
[active] => 1
[inactivereason] => 0
[short_description] =>
[description] => <p></p>
[onsale] => 0
[saleprice] => 0.00
[sold] => 0
[temp_id] => 15689048211457888113
[id] => 1
[rim_pcolor] => black
[rim_material] => Aluminum Alloy
[rim_width] => 8.5
[rim_diameter] => 17
[rim_backspacing] => 4.750
[rim_offset] => 0
[rim_bnum] => 5
[rim_bpat] => 5x127
[rim_bore] => 71.50
[rim_structure] => One Piece
[rim_ln_seat] => Conical seat - 60 degree
[rim_holc] => lug
[rim_cc_inc] => 1
)
And what I'm getting:
[0] => Array
(
[id] => 1
[title] => Pro Comp Series 5034 Rockwell Satin Black Rim 5 x 5 17 x 8.5
[short_title] => Rockwell Satin Black Rim
[price] => 157.00
[shipping] => 0.00
[quantity] => 0
[quantity_sold] => 0
[category] => 1
[brand] => 1
[model] => 1
[mpn] => PXA5034-78573
[citype] => wheel
[added] => 1459958500
[lastupdate] => 1461074302
[active] => 1
[inactivereason] => 0
[short_description] =>
[description] => <p></p>
[onsale] => 0
[saleprice] => 0.00
[sold] => 0
[temp_id] => 15689048211457888113
)
[1] => Array
(
[id] => 1
[rim_pcolor] => black
[rim_material] => Aluminum Alloy
[rim_width] => 8.5
[rim_diameter] => 17
[rim_backspacing] => 4.750
[rim_offset] => 0
[rim_bnum] => 5
[rim_bpat] => 5x127
[rim_bore] => 71.50
[rim_structure] => One Piece
[rim_ln_seat] => Conical seat - 60 degree
[rim_holc] => lug
[rim_cc_inc] => 1
)