Sherin Green Sherin Green - 6 months ago 22
SQL Question

How to perform AND operation in between two OR_LIKE queries in codeigniter

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

Answer

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');
Comments