1,变量赋值,where($map)
$Tixian = M("Tixian"); // 实例化User对象// 要修改的数据对象属性赋值
$map['id'] = $_GET['tixian_id'];
//$a=$_GET['tixian_id'];var_dump($a);
$Tixian->status = '1';$Tixian->beizhu = $_GET['beizhu'];
$Tixian->where($map)->save(); // 根据条件更新记录
// echo $Tixian->getLastSQL();exit;
$this->success('OK:' , U('Tixian/list'), 2);
2,拼接,where('id='.$msg_id)
public function editAction($msg_id){
$m_msg = D('Msg');
// 处理提交的数据
$m_msg->create(); // 默认去post中获取数据
$m_msg->starttime =strtotime(date("Y-m-d H:s:i",strtotime($_POST['starttime'])));
$m_msg->endtime =strtotime(date("Y-m-d H:s:i", strtotime($_POST['endtime'])));
$m_msg->content = htmlspecialchars_decode($_POST['content']);
// 数据校验通过
$m_msg->where('id='.$msg_id)->save();
}
view:
<form action="{:U('edit', ['msg_id'=>$msg['id']])}" method="post" enctype="multipart/form-data">