hi guys,... can anyone help please,... I have a photos table where I want to change privacy settings for all photos with one click,... however it only change value for the first photo on the list ( where I have 9 photos). here is my links and function for private,... what am I doing wrong,...?
<?php echo $html->link(ucfirst(__('set Public', true)), '/photos/set_public/' . $user_obj['User']['id'], array('style' => 'font-weight: bold;')) ?> <?php echo $html->link(ucfirst(__('set Friend', true)), '/photos/set_friend/' . $user_obj['User']['id'], array('style' => 'font-weight: bold;')) ?> <?php echo $html->link(ucfirst(__('set Private', true)), '/photos/set_private/' . $user_obj['User']['id'], array('style' => 'font-weight: bold;')) ?> function set_private($id = null) { $this->authorize(); if(!($user = $this->User->findById($id))) { $this->flash('error', ucfirst(i18n::translate('usermmm not found'))); $this->redirect('/not_found'); } elseif(!($user['User']['token'] == NULL)) { $this->flash('error', ucfirst(i18n::translate('userddd not found'))); $this->redirect('/not_found'); } else { $this->authorize($user['User']['id']); $photos = $this->Photo->find('all', array('conditions' => array('Photo.user_id' => $user['User']['id']))); $this->set('photos', $photos); foreach ($photos as $photo) { $this->Photo->query('UPDATE fociki_photos SET privacy = 2 WHERE id = ' . $photo['Photo']['id']); $this->flash('valid', ucfirst('your photos privacy set to private.')); $this->redirect($_SERVER['HTTP_REFERER']); } $this->set('user_obj', $user); } } thanks in advance chris -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.