CakePhPの新規登録フォーム作成で
Error: 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 'getActiviationHash' at line 1
CakePHP2.x PHP7.1.23
sqlがMAMP上のphpmyadminも正常に動いているのですが、ターミナル上でservice sql status , sql versionを入れてもnot found で返ってきてしまうのでバージョンが分かりません。
というエラーに関して質問させて下さい。
自分のクエリ文に対してのエラーだと思うのですが、CakePHPの公式サイトを見ても文法エラーは見当たらないの
で、どなたかCakePHPにお詳しい方チェックして頂けないでしょうか。
よろしくお願いします。
<?php App::uses('AppController', 'Controller'); App::uses('CakeEmail','Network/Email'); class UsersController extends AppController { public function beforeFilter(){ parent::beforeFilter(); //$this->Auth->allow(array('signup','activate')); } public function signup(){ if($this->request->is('post')){ if($this->User->save($this->data)){ $url='activate/'.$this->User->id.'/'.$this->User->getActiviationHash(); $url=Router::url($url,true); $email=new CakeEmail(); $email->from(array('kentotamu@gmail.com' =>'Sender')); $email->to($this->data['User']['email']); $email->subject('Registration mail'); $email->send($url); $this->Session->setFlash('Please check Email'); }else{ $this->Session->setFlash('Error'); } } } public function activate($user_id=null,$in_hash=null){ $this->User->id=$user_id; if($this->User->exists() && $in_hash==$this->User->getActiviationHash() ){ $this->User->saveFiled('active',1); $this->Session->setFlash('Your registration is seccessed'); }else{ $this->Session->setFlash('Invalid link'); } } } ?> コード
回答1件
あなたの回答
tips
プレビュー