Hi guys, Trying to create members join function and need to save and update in 3 tables. Here is what I have, but its not working, it's not adding to GroupMember table... any clue...?
function join($id) { if(!($user = $this->User->findById($this->user['id']))) { $this->flash('error', ucfirst(i18n::translate('user not found'))); $this->redirect('/'); } else { if(!($group = $this->Group->findById($id))) { $this->flash('error', ucfirst(i18n::translate('group not found'))); $this->redirect('/'); } else { $group['Group']['favorites'] = 1; if(!$this->Group->save($group)) { $this->flash('error', ucfirst(i18n::translate('unexpected'))); } else { $member['GroupMember']['group_id'] = $group['Group']['id']; $member['GroupMember']['user_id'] = $user['User']['id']; if(!$this->GroupMember->save($this->$member)) { $this->User->query('UPDATE fociki_users' . ' SET group_favorites = group_favorites + 1' . ' WHERE id = ' . $this- >user['id']); $this->flash('valid', ucfirst(i18n::translate('thank you for join. It is also added to your groups favorites'))); } } $this->redirect('/groups/index/' . $user['User']['username']); } } } Thanks Chris Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en