Combining `where` and `like` statements by using the CI activerecords

前端 未结 6 2251
一个人的身影
一个人的身影 2021-01-06 18:48

To cut a long story short: Is it possible and if it is - how can I build a query that looks somewhat like this one

SELECT * FROM a
    WHERE row = 1 AND 
            


        
6条回答
  •  说谎
    说谎 (楼主)
    2021-01-06 19:26

    $sql= "SELECT * FROM `a`
    WHERE row = '1' AND 
    (other_row LIKE '%" . $value . "%' OR another_row LIKE '%" . $value . "%')";
     $this->db->query($sql);
    

提交回复
热议问题