0

Cakephp 2.2.1 を使用していて、cakedc ユーザー プラグインを使用しようとしています。ユーザーを作成しようとすると、次のエラーが表示されます。このエラーを解決するためのヒントやアドバイスを教えてください。マイグレーション プラグインを使用してすべてのテーブルをロードしました。前もって感謝します :)。

2013-04-07 06:31:33 Error: [PDOException] SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'register' at line 1
#0 C:\wamp\www\toppin\lib\Cake\Model\Datasource\DboSource.php(459): PDOStatement->execute(Array)
#1 C:\wamp\www\toppin\lib\Cake\Model\Datasource\DboSource.php(425): DboSource->_execute('register', Array)
#2 C:\wamp\www\toppin\lib\Cake\Model\Datasource\DboSource.php(669): DboSource->execute('register', Array, Array)
#3 C:\wamp\www\toppin\lib\Cake\Model\Datasource\DboSource.php(611): DboSource->fetchAll('register', Array, Array)
#4 C:\wamp\www\toppin\lib\Cake\Model\Model.php(788): DboSource->query('register', Array, Object(User))
#5 C:\wamp\www\toppin\app\Plugin\Users\Controller\UsersController.php(331): Model->__call('register', Array)
#6 C:\wamp\www\toppin\app\Plugin\Users\Controller\UsersController.php(331): User->register(Array)
#7 [internal function]: UsersController->add()
#8 C:\wamp\www\toppin\lib\Cake\Controller\Controller.php(485): ReflectionMethod->invokeArgs(Object(UsersController), Array)
#9 C:\wamp\www\toppin\lib\Cake\Routing\Dispatcher.php(186): Controller->invokeAction(Object(CakeRequest))
#10 C:\wamp\www\toppin\lib\Cake\Routing\Dispatcher.php(161): Dispatcher->_invoke(Object(UsersController), Object(CakeRequest), Object(CakeResponse))
#11 C:\wamp\www\toppin\app\webroot\index.php(92): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#12 {main}

機能を追加:

public function add() {
        if ($this->Auth->user()) {
            $this->Session->setFlash(__d('users', 'You are already registered and logged in!'));
            $this->redirect('/');
        }

        if (!empty($this->request->data)) {
            $user = $this->User->register($this->request->data);
            if ($user !== false) {
                $this->_sendVerificationEmail($this->User->data);
                $this->Session->setFlash(__d('users', 'Your account has been created. You should receive an e-mail shortly to authenticate your account. Once validated you will be able to login.'));
                $this->redirect(array('action' => 'login'));
            } else {
                unset($this->request->data[$this->modelClass]['password']);
                unset($this->request->data[$this->modelClass]['temppassword']);
                $this->Session->setFlash(__d('users', 'Your account could not be created. Please, try again.'), 'default', array('class' => 'message warning'));
            }
        }
    }
4

2 に答える 2

0

$this->request->dataユーザーテーブルに対してコンテンツをチェックする必要があります。おそらく、一部の値が無効です

于 2013-04-07T07:26:30.460 に答える