title: CakePHP Foreach Find Loop Issue
body: <p>Now, I have spaced the only right output I get, that number is a step_id but then it does not give me all the over IDs. Like I said, I was hoping the debug would print/echo ALL step_ids on the screen when the user_id in my steps table, is the right type of id.</p>
  
  <p>DEBUG OUTPUT BELOW:</p>
  
  <p>app/controllers/steps_controller.php (line 109)<br><br>
  1323<br><br>
  Notice (8): Undefined offset: 1 [APP/controllers/steps_controller.php, line 109]app/controllers/steps_controller.php (line 109)</p>
  
  <p>Notice (8): Undefined offset: 2 [APP/controllers/steps_controller.php, line 109]app/controllers/steps_controller.php (line 109)</p>
  
  <p>Notice (8): Undefined offset: 3 [APP/controllers/steps_controller.php, line 109]app/controllers/steps_controller.php (line 109)</p>
  
  <p>Notice (8): Undefined offset: 4 [APP/controllers/steps_controller.php, line 109]app/controllers/steps_controller.php (line 109)</p>
  
  <p>Notice (8): Undefined offset: 5 [APP/controllers/steps_controller.php, line 109]app/controllers/steps_controller.php (line 109)</p>
  
  <p>Notice (8): Undefined offset: 6 [APP/controllers/steps_controller.php, line 109]app/controllers/steps_controller.php (line 109)</p>
  
  <p>Notice (8): Undefined offset: 7 [APP/controllers/steps_controller.php, line 109]app/controllers/steps_controller.php (line 109)</p>
  
  <p>Notice (8): Undefined offset: 8 [APP/controllers/steps_controller.php, line 109]app/controllers/steps_controller.php (line 109)</p>
  
  <p>UPDATE :</p>
  
  <p>I am not sure if this was an error or not but in my foreach loop I had 'Step.user_id', when then find command is pointing to the Step table anyway, so I changed it! But It still does not work.</p>
  
  <p>With, the new code below, more or less the same code it was. I have used a debug command to print ALL the step Ids when the user id in the steps table matches to the user id that are only of the right role, e.g. >3. However the debug only gives me one returned result! And then 'Undefined offset:' 1 to 8. </p>
  
  <p>Any ideas of what I am doing wrong? Please??</p>
  
  <pre><code>        foreach($getUserIds as $k=&gt;$data) {
              //$StepConditions = ;
  
              $getStepIds = $this-&gt;Step-&gt;find('all', array('conditions' =&gt; array('user_id' =&gt; $getUserIds[$k]['User']['id'])));
  
              debug($getStepIds[$k]['Step']['id']);
  
          }
  </code></pre>
  
  <hr>
  
  <p>I have searched on here but I can't seem to find anyone who as posted about this problem, so I hope you can help!</p>
  
  <p>Ok, the main aim of my function is to get all the 'steps' out of my database but only when the user_id is > 3. </p>
  
  <p>I am very new the CakePHP, so I am not very good with these find commands let. Now, as it stands, If I debug $getSteps, it only gives me 0,1 &amp; 2 numbered arrays. All the info in theme is right but I do know there is more than three steps done by the user group. </p>
  
  <p>Then I debug, $getUserIds, it gives me all the user Ids I wanted but not all the steps done my all this users, just three I said.</p>
  
  <p>Any hope is most welcome!</p>
  
  <p>Many Thanks Glenn</p>
  
  <pre><code>function Breakdown($id = null) {
      $getUserIds = $this-&gt;Step-&gt;User-&gt;find(
          'all',
          array(
              'conditions' =&gt; array('role_id' =&gt; 2)
               )
          );
  
      foreach ($getUserIds as $k=&gt;$data) {
  
          $getSteps = $this-&gt;Step-&gt;find(
                  'all', 
                  array(
                        'conditions' =&gt; array('Step.user_id' =&gt; $getUserIds[$k]['User']['id'])
                       ) 
          );
          debug($getSteps);
  
      }
  
  die();
  } //End of Breakdown() function
  </code></pre>