Codeigniter parentheses in dynamic Active Record query

后端 未结 8 1580
死守一世寂寞
死守一世寂寞 2020-12-05 23:38

I\'m producing a query like the following using ActiveRecord

SELECT * FROM (`foods`) WHERE `type` = \'fruits\' AND 
       `tags` LIKE \'%green%\' OR `tags`          


        
8条回答
  •  独厮守ぢ
    2020-12-06 00:18

    One of best feature to save your query when you applying multiple where or_where clauses.

    $this->db->group_start();
    $this->db->where();
    $this->db->or_where();
    $this->db->group_end();
    

    Happy Coding. :)

提交回复
热议问题