내 codeigniter 앱에서 문제가 발견되었습니다. 나는 4 개의 다른 like와 or_like를 사용하여 간단한 검색 쿼리를 작성했다.Codeigniter like, or_like가 작동하지 않습니다.
$q = $this->db->select('*')
->from('table')
->like('col', $search_string1, both)
->or_like('col', $search_string2, both)
->or_like('col', $search_string3, both)
->or_like('col', $search_string4, both)
->get()->results
그리고 내가 원하는,하지만 난 "활성"라는 내 테이블에 새 COL을 추가하기로 결정하고 내가 활성 가지고 행만을 표시 할대로 작동 = 1. 그래서 난 내 쿼리에 어디에 추가하려고 ,하지만 예상대로 작동하지 않았습니다.
$q = $this->db->select('*')
->from('table')
->where('active', 1)
->like('col', $search_string1, both)
->or_like('col', $search_string2, both)
->or_like('col', $search_string3, both)
->or_like('col', $search_string4, both)
->get()->results
이 쿼리는 활성 세트가 0으로 설정된 행을 표시합니다. 대답은 CI에서 SQL을 배우는 사람들에게 명백하지 않을 수 있기 때문에
상태가 다음과 같아야합니다. – Gulshan