dounielong7728 2016-02-05 06:49
浏览 446
已采纳

如何在codeigniter中的两个OR_LIKE查询之间执行AND操作

I perform a multiple search using multiple join query in code igniter so i perform 3 or_like query.But there is an 'OR' placed in between each or_like query by default by code igniter.But actualy i want to perform 'AND' Operation Between them.Please help me. Thanks

  • 写回答

2条回答 默认 最新

  • duanliao3826 2016-06-04 06:18
    关注

    We can do it very simply in codeigniter version 3.0

    eg,

        $this ->db ->select('*');
        $this ->db ->where('age',$age);
        $this ->db ->where('country',$country);
        $this->db->group_start();
        $this ->db ->or_where('state',$state);
        $this ->db ->or_where('district',$district);
        $this->db->group_end();
        $query=$this ->db ->get('pg_reg');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?