Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The array you show us can't exist in reality. Each array key must be unique, or it will just be overwritten. You use <code>order_item</code> multiple times. What you can do is this:</p> <pre><code>Array ( [0] =&gt; Array ( [order_items] =&gt; Array ( Array ( [id] =&gt; 1 [order_id] =&gt; 1 [userid] =&gt; 1 [item_number] =&gt; 3 [itemName] =&gt; Item A [price] =&gt; 1.99 [quantity] =&gt; 1 [total] =&gt; 1.99 [item_status] =&gt; Not Filled [created] =&gt; 2013-06-13 07:42:00 [modified] =&gt; 2013-06-13 07:42:00 ) , Array ( [id] =&gt; 2 [order_id] =&gt; 1 [userid] =&gt; 1 [item_number] =&gt; 4 [itemName] =&gt; Item B [price] =&gt; 1.99 [quantity] =&gt; 1 [total] =&gt; 1.99 [item_status] =&gt; Not Filled [created] =&gt; 2013-06-13 07:42:00 [modified] =&gt; 2013-06-13 07:42:00 ) ), [Order] =&gt; Array ( [id] =&gt; 1 [userid] =&gt; 4 [order_status] =&gt; Not Filled [email] =&gt; test@gmail.com [total] =&gt; 1.99 [fullName] =&gt; Test [address] =&gt; Test [city] =&gt; Test [state] =&gt; IA [zip] =&gt; 12345 [created] =&gt; 2013-06-13 07:42:00 [modified] =&gt; 2013-06-13 07:42:00 ) ) ) </code></pre> <p><em>(This is probably not exactly how the print would look, but you get the idea)</em></p> <p>You can then use your pseudo code</p> <pre><code>$data = array(); foreach($order_values as $order){ array_push($data, array('Order ID', 'Order total', etc...)) //Order headings go here array_push($data, $order[Order]['id'], order[Order]['item_number']..); //order data here. There is always only 1 line of order data per order array_push($data, array('Item number', 'Item Price', etc..)); //order items headings go here foreach($order['order_items'] as $order_item){ array_push($data, //now add the order items for the specific order) } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload