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.
DEBUG OUTPUT BELOW:
app/controllers/steps_controller.php (line 109)
1323
Notice (8): Undefined offset: 1 [APP/controllers/steps_controller.php, line 109]app/controllers/steps_controller.php (line 109)
Notice (8): Undefined offset: 2 [APP/controllers/steps_controller.php, line 109]app/controllers/steps_controller.php (line 109)
Notice (8): Undefined offset: 3 [APP/controllers/steps_controller.php, line 109]app/controllers/steps_controller.php (line 109)
Notice (8): Undefined offset: 4 [APP/controllers/steps_controller.php, line 109]app/controllers/steps_controller.php (line 109)
Notice (8): Undefined offset: 5 [APP/controllers/steps_controller.php, line 109]app/controllers/steps_controller.php (line 109)
Notice (8): Undefined offset: 6 [APP/controllers/steps_controller.php, line 109]app/controllers/steps_controller.php (line 109)
Notice (8): Undefined offset: 7 [APP/controllers/steps_controller.php, line 109]app/controllers/steps_controller.php (line 109)
Notice (8): Undefined offset: 8 [APP/controllers/steps_controller.php, line 109]app/controllers/steps_controller.php (line 109)
UPDATE :
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.
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.
Any ideas of what I am doing wrong? Please??
foreach($getUserIds as $k=>$data) {
//$StepConditions = ;
$getStepIds = $this->Step->find('all', array('conditions' => array('user_id' => $getUserIds[$k]['User']['id'])));
debug($getStepIds[$k]['Step']['id']);
}
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!
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.
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 & 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.
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.
Any hope is most welcome!
Many Thanks Glenn
function Breakdown($id = null) {
$getUserIds = $this->Step->User->find(
'all',
array(
'conditions' => array('role_id' => 2)
)
);
foreach ($getUserIds as $k=>$data) {
$getSteps = $this->Step->find(
'all',
array(
'conditions' => array('Step.user_id' => $getUserIds[$k]['User']['id'])
)
);
debug($getSteps);
}
die();
} //End of Breakdown() function
Its OK,
I have solved my problems! I think the users were assigned to each step but they are only assigned to the project, therefore it does not work.
What I am going to do is make a new table and build my links to each step for each user.
Many Many Thanks For All The Help and support you guys have given me on this!
Glenn Curtis.