public function Index(){
//通过账号,真实姓名,手机号查询模糊查询
$user=M('cuser');
$where="( IFNULL(projectno,'".session("user")['projectno']."') = '".session("user")['projectno']."' OR projectno='' )";
if(!empty(I('param.name'))){
$name=trim(I('param.name'));
$where .=" and name like'%{$name}%' OR realname like '%{$name}%' OR phone like '%{$name}%'";
}
$this->assign('name',$name);
$count=$user->where($where)->count();
/*实例化分页类 传入总记录数和每页显示的记录数*/
$Page = new Page($count,10);//
/*分页显示输出*/
$show = $Page->show();
/*进行分页数据查询 注意limit方法的参数要使用Page类的属性*/
$page=I('param.p');
if(empty($page)){
$page=1;
}
$list=$user->where($where)->order("id desc")->limit($Page->firstRow.",".$Page->listRows)->select();
$this->assign('list',$list);
$this->assign('page',$show);
$this->display(index);
}