更新数据时出错了 [ 新手入门 ]
public function actionEdit(){
$admin_id = Yii::app()->request->getParam('admin_id');
$username = Yii::app()->request->getParam('username');
$password = Yii::app()->request->getParam('password');
if(Yii::app()->request->isPostRequest){
$data = array('username' => $username,'password' => $password);
$count =Admin::model()->updateByPk($admin_id,$data);
//$adminModel->findByPk($admin_id);
//s$adminModel ->attributes=$data;
if($count){
$this->redirect(Yii::app()->baseUrl.'/admin/admin/index/');
}
}
$adminModel = new Admin();
$condition="admin_id=".$admin_id;
$adminInfo = $adminModel->find($condition,array('id','username'));
$this->render('edit',array('admininfo'=>$adminInfo));
}
报这个错误
CDbCommand failed to execute the SQL statement: 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 'LIMIT 1' at line 1. The SQL statement executed was: SELECT * FROM `webgame_admin` `t` WHERE admin_id= LIMIT 1
共 1 条回复
wonderwong 深圳
注册时间:2012-03-21
最后登录:2024-06-01
在线时长:10小时29分
最后登录:2024-06-01
在线时长:10小时29分
- 粉丝8
- 金钱290
- 威望70
- 积分1090