I have to make a foreach cycle to check every item of a certain group.
For each and every item I've got to check a condition and make a data
modification depending on this condition.
My code is the following:
foreach($posts as $p) {
$this->Post->id = $p['Post']['id']; //consider the posts one
by one
if ($this->Post->id == $var) {
$this->data['Post']['options'] = value1;
} else {
$this->data['Post']['options'] = value 2;
}
$this->Post->save($this->data);
}
Here is my problem: the modifications are performed correctly for the
IF branch, but NEVER for the else branch.
Do you know why this occurs?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---