On Fri, Sep 10, 2010 at 7:34 PM, Lance <[email protected]> wrote: > Got it figured out! I kept using the debug(); function until my > variable values made sense. > I hope this helps people who are trying to validate against the > database while editing a user. > It makes sure the value isUnique. Just adjust the fieldname to what > you need to validate against. > > function checkUnique() > { > if($this->find('count', array('conditions' => > array('User.username' > => $this->data['User']['username']))) && $this->id > 0 ) > > { > > $match_user = $this->find('first', > array('conditions' => > array('User.username' => $this->data['User']['username']))); > > if($this->id != > $match_user['User']['id']) > { > return false; > } > > } > return true; > }
Bingo! Yes, that's the way. Sorry, but I just saw this thread. 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 [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
