sql模糊查询,模糊查询

作者:计算机知识
   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);
    }

必赢亚洲博彩,sql模糊查询,模糊查询。混淆查询,sql模糊查询

   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);
    }

 

public function Index(){ //通过账号,真实姓名,手提式有线电电话机号查询模糊查询 $user=M('cuser'); $where="( IFNULL(projectno,'".session("user")[...

 2.

本文由bwin必赢发布,转载请注明来源

关键词: 必赢体育BWIN