cakephp 2.2.4编辑动作数据不更新到数据库中

时间:2016-08-02 12:28:52

标签: php cakephp-2.3

这是我的编辑操作

public function edit($id = null) {
        $this->User->id = $id;
        if (!$this->User->exists()) {
            throw new NotFoundException(__('Invalid user'));
        }
        if ($this->request->is('post') || $this->request->is('put')) {
            if ($this->User->save($this->request->data)) {
                $this->Session->setFlash(__('The user has been saved'));
                $this->redirect(array('action' => 'index'));
            } else {
                $this->Session->setFlash(__('The user could not be saved. Please, try again.'));
            }
        } else {
            $this->request->data = $this->User->read(null, $id);
        }
    }

我尝试更新一行但得到以下错误 数据库错误

错误:SQLSTATE [42S22]:未找到列:1054'where子句'中的未知列'bsmltravel@2016.users.id'

SQL Query: UPDATE `bsmltravel@2016`.`users` SET `id` = 1, `username` = 'test', `password` = 'test', `status` = 1, `created_by` = 1, `modified_by` = 1, `modified` = '2016-08-02 14:21:59' WHERE `bsmltravel@2016.users.id` = '1' 

0 个答案:

没有答案