错误提示: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));