查询出现错误,请问是什么原因?

错误提示:CDbCommand 无法执行 SQL 语句: CDbCommand 无法准备 SQL 语句: SQLSTATE[HY000]: General error: 1 near " ": syntax error

代码:


public function loadLink($id = null) {

        if ($this->_model === null) {

            if ($id !== null || isset($_GET['id']))

                $this->_model = Link::model()->findbyPk($id !== null ? $id : $_GET['id']);

            if ($this->_model === null)

                throw new CHttpException(404, 'The requested page does not exist.');

        }

        return $this->_model;

    }


$model = $this->loadLink();

        if (isset($_POST['Link'])) {

            $model->attributes = $_POST['Link'];

            if ($model->save()) {

                $this->redirect(array('list'));

            }

        }

        $this->render('update', array('model' => $model));

已经解决,原来是牵涉到其他模型查询出错了。不好意思。

麻烦解决后在标题标注一下~ thankyou!

没有看到可以修改标题的地方 :o

在编辑状态下,在Save按钮旁边有个 Full Edit的按钮,转到完整编辑就可以更改标题了~