Thinkphp3.2.3 为什么我的数据更新不了啊?求解。 30
publicfunctionupdate(){$model=M('User')->find(I('id'));$this->assign('model',$model);...
public function update(){
$model = M('User')->find(I('id'));
$this->assign('model',$model);
$this->display();
if(isset($_POST['id'])){
$data['username'] = $_POST['username'];
$data['password'] = $_POST['password'];
$result=$model->where('id='.$_POST['id'])->save($data);
if($result){
$this->success("用户信息更新成功", U('Yonghu/yonghu'));
}
else{
$this->error("更新失败");
}
}
} 展开
$model = M('User')->find(I('id'));
$this->assign('model',$model);
$this->display();
if(isset($_POST['id'])){
$data['username'] = $_POST['username'];
$data['password'] = $_POST['password'];
$result=$model->where('id='.$_POST['id'])->save($data);
if($result){
$this->success("用户信息更新成功", U('Yonghu/yonghu'));
}
else{
$this->error("更新失败");
}
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询