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

前端 未结 6 2301
一个人的身影
一个人的身影 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:03

    $this->db->where('salary_range_min >= ',$salarymin)
    $this->db->where('salary_range_max <= ',$salarymax)
    $this->db->where('job_title like '.$title.'% or skill like %'.$title.'%');
    // OR */
    $this->db->where('job_title like '.$title.'% or skill like %'.$title.'%',FALSE);
    // OR */
    $this->db->where('job_title like '.$title.'% or skill like %'.$title.'%',NULL);
    

    Try this out

提交回复
热议问题