Hi,
I am new to this framework and have been using it for about 3 days.
I created a register action for people to register. When using it, it
throws the "Thank you for registering'" flash message, but it doesn't
creates nothing in the database.
I would appreciate any help.

        function register(){
                $this->set('username_error', 'username is required');
                $this->set('password_error', 'password is required');
                $this->set('email_error', 'email address is required');
                if (!empty($this->data) && $this->User->validates()) {
                        if 
($this->User->findByUsername($this->data['User']['username'])) {
                        $this->User->invalidate('username');
                        $this->set('username_error', 'username already exists');
                        }
                        elseif 
($this->User->findByEmail($this->data['User']['email'])){
                        $this->User->invalidate('email');
                        $this->set('email_error', 'email address already in 
use');
                        }
                        else {
                        $this->data['User']['password'] = 
md5($this->data['User']
['password']);
                        $this->User->save($this->data);
                        $this->Session->write('Users.username', $this->User-
>findByUsername($this->data['User']['username']));
                        $this->Session->setFlash('Thank you for registering');
                        $this->redirect('/');
                        }
                }
                else {
                $this->validateErrors($this->User);
                }
        }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to