I have two MYSQL tables ‘Piece’ and ‘Order1’
in PHP I would like to loop through each Order (& the pieces within) in this $_POST array and store it in my database.
I’ve tried to do a while loop, to store each individual order but have been unable to get the pieces underneath each order. I’m thinking maybe this is not the way to go.
If someone to give me an example or suggestion it would be great.
[order] => Array
(
[details] => Array
(
[0] => Array
(
[order1_itemcode] =>
[order1_description] =>
[order1_itemprice] =>
[order1_packagetype] => 0
[pieces] => Array
(
[0] => Array
(
[piece_length] => 235
[piece_width] => 235
[piece_height] => 235
[piece_unittype] => cm
[piece_actualweight] =>
[piece_weighttype] => kg
)
[1] => Array
(
[piece_length] => 346
[piece_width] => 346
[piece_height] => 346
[piece_unittype] => cm
[piece_actualweight] =>
[piece_weighttype] => kg
)
)
)
[1] => Array
(
[order1_itemcode] =>
[order1_description] =>
[order1_itemprice] =>
[order1_packagetype] => 0
[pieces] => Array
(
[0] => Array
(
[piece_length] => 46
[piece_width] => 346
[piece_height] => 346
[piece_unittype] => cm
[piece_actualweight] =>
[piece_weighttype] => kg
)
[1] => Array
(
[piece_length] => 346
[piece_width] => 223
[piece_height] => 235
[piece_unittype] => cm
[piece_actualweight] =>
[piece_weighttype] => kg
)
)
)
)
)
Try this :