title: Codeigintier Loop Through Multidimensional Array Getting Error Undefined index:
body: <p>I have a multidimensional Array. </p>
  
  <pre><code>Array
  (
  [0] =&gt; Array
      (
          [OrderID] =&gt; 94
          [AccountID] =&gt; 1
          [UserID] =&gt; 1
          [OrderStatus] =&gt; POSTED
          [OrderType] =&gt; Buy
          [Subtotal] =&gt; 231.91
          [ExchangeFee] =&gt; 5.00
          [OrderFee] =&gt; 0.00
          [TotalFee] =&gt; 5.00
          [GrandTotal] =&gt; 226.91
          [Notes] =&gt; 
          [DateCreated] =&gt; 2013-12-11 10:51:27
          [OrdersDetail] =&gt; Array
              (
                  [0] =&gt; Array
                      (
                          [OrderDetailID] =&gt; 96
                          [OrderID] =&gt; 94
                          [CurrencyID] =&gt; 3
                          [CheckCurrency] =&gt; 1
                          [TransTypeID] =&gt; 4
                          [Credit] =&gt; 300.00
                          [Rate] =&gt; 0.773044
                          [Debit] =&gt; 231.91
                          [Fee] =&gt; 5.00
                          [LineTotal] =&gt; 226.91
                          [Description] =&gt; Australian Dollar
                          [TransType] =&gt; Cash
                      )
  
              )
  
      )
  
  )
  </code></pre>
  
  <p>Which was created by a function in my model. I then have the following code in my controller. </p>
  
  <pre><code>$this-&gt;Data['OrdersArray'] = $this-&gt;orders-&gt;getOrdersToday('Buy');
  </code></pre>
  
  <p>I which works great. What I am trying to do is in my view use two foreach statments to parse the information in the multi array to build a list of information. And this is what I have in my view. </p>
  
  <pre><code>&lt;tbody&gt;
  &lt;? if(isset($OrdersArray) &amp;&amp; $OrdersArray){ ?&gt;
      &lt;?php foreach ($OrdersArray as $key=&gt;$item):?&gt;
      &lt;tr class="&lt;?=alternator('odd','even')?&gt;"&gt;
          &lt;td&gt;&lt;?=$item['OrderID']?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?=$item['OrderStatus']?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?=$item['UserID']?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?=$item['Subtotal']?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?=$item['OrderFee']?&gt;&lt;/td&gt; 
          &lt;td&gt;&lt;?=$item['GrandTotal']?&gt;&lt;/td&gt;                          
      &lt;/tr&gt;
      &lt;?php endforeach;?&gt; 
  &lt;? } ?&gt;
  &lt;? if(isset($OrdersArray) &amp;&amp; $OrdersArray){ ?&gt;                          
      &lt;?php foreach ($OrdersArray as $key=&gt;$item):?&gt;
          &lt;tr class="&lt;?=alternator('odd','even')?&gt;"&gt;
              &lt;td&gt;&lt;?=$item['Description']?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?=$item['Credit']?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?=$item['Rate']?&gt;&lt;/td&gt;                         
          &lt;/tr&gt;                                
      &lt;?php endforeach;?&gt;                                                                                   
  &lt;? } ?&gt;
  &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I want to get all of this information on one line and I keep getting an Undefined index: error. So I guess my problem is I do not understand how to correctly write the foreach statements so they loop through all of the information. All help greatly appreciated. </p>