且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

插入新行而不是更新当前行

更新时间:2023-12-04 12:08:58

Make sure you are passing the PK to the $this->Model->save() or it will create a new ID for the PK field. Also, the $this->data should be sent to the save as $this->data with the name of the model included. So if your model name is Test, try sending it like:

$this->Test->save($this->data)

NOT

$this->Test->save($this->data['Test'])