title: Looping through the data from database
body: <p>Hey I have got data in my variable using foreach($report as &amp;rep)</p>
  
  <p>note it is getting things from 4 different table in database</p>
  
  <p>Now when I print my $rep I get the following:</p>
  
  <pre><code>Array
  (
      [Report] =&gt; Array
          (
              [id] =&gt; 246
              [emp] =&gt; werock
              [name] =&gt; werock
              [organization] =&gt; cakephp
              [customer] =&gt; great
          )
  
      [file] =&gt; Array
          (
              [0] =&gt; Array
                  (
                      [id] =&gt; 211
                      [report_id] =&gt; 246
                      [file_name] =&gt; 
                      [file_type] =&gt; 
                      [file_size] =&gt; 0
                      [file_error] =&gt; 4
                      [file_tag] =&gt; 0
                  )
  
          )
  
      [Engineer] =&gt; Array
          (
              [0] =&gt; Array
                  (
                      [id] =&gt; 232
                      [report_id] =&gt; 246
                  )
  
          )
  
      [Issue] =&gt; Array
          (
              [0] =&gt; Array
                  (
                      [id] =&gt; 118
                      [report_id] =&gt; 246
                      [date_created] =&gt; 2012-02-10
                      [status] =&gt; wait
                  )
  
              [1] =&gt; Array
                  (
                      [id] =&gt; 119
                      [report_id] =&gt; 246
                      [date_created] =&gt; 2012-02-10
                      [status] =&gt; debug
                  )
  
              [2] =&gt; Array
                  (
                      [id] =&gt; 120
                      [report_id] =&gt; 246
                      [date_created] =&gt; 2012-02-10
                      [status] =&gt; Completed
  
                  )
  
          )
  
  )
  </code></pre>
  
  <p>Now what I want to do is access Issues array and check how many array are there in it. in this case 3(0,1,2). and print the value of status for the last index in this case(2). </p>
  
  <p>But when I do $rep['Issue']['status'] I get Undefined index: status. Can you tell me where I might be going wrong.</p>