public function rewardlog(){ $adminNav = C(‘ADMIN_NAV‘); $adminNav[1][‘class‘] = ‘cur‘; $this->assign(‘adminNav‘,$adminNav); $where = ‘And 1=1‘; if($_POST){ $input = trim($_POST[‘input‘]); if($input != ‘‘){ $where = ‘AND u.nickname like \‘%‘.$input.‘%\‘ OR r.message_code like \‘%‘.$input.‘%\‘ group by r.id‘; } } $sql ="SELECT r.id,u.nickname,p.pname,r.choosetime,r.message_code,r.gettime FROM `1008_reward` r,`1008_user` u,`1008_prize` p WHERE r.uid = u.id AND r.rid = p.id $where"; $model = M(); $list = $model->query($sql); $count = count($list); $Page = new Page($count,10); $show = $Page->show(); $res = $model->query($sql." limit {$Page->firstRow},{$Page->listRows}"); $this->assign(‘input‘,$input); $this->assign(‘res‘,$res); $this->assign(‘page‘,$show); $this->assign(‘title‘,‘中奖记录‘); $this->display(); }
1、查询用query 添加与修改用execute
时间: 2024-10-01 01:57:39