while generating the query through codeigniter framework
$this->db->select('id,memo,sent_to,sent_by,read_by,date')->from('memos')
->where("FIND_IN_SET('1',`sent_to`)")->order_by('`id`','DESC')->get();
i got an error of adding IS NULL in the query automatically
it produce
SELECT `id`, `memo`, `sent_to`, `sent_by`, `read_by`, `date` FROM `memos`
WHERE FIND_IN_SET('1',`sent_to`) IS NULL ORDER BY `id` DESC
instead of
SELECT `id`, `memo`, `sent_to`, `sent_by`, `read_by`, `date` FROM `memos`
WHERE FIND_IN_SET('1',`sent_to`) ORDER BY `id` DESC
You simply need to write a mysql query for string variable and run it by using
$this->db->query('');
instead of using active record.P/s: Sorry for my bad english.
Use this
find_in_set()
returns numeric value so thats why we need to use relational operator to evaluate condition likeBelow code 100% work. try it,
You need to add
!=0
is yourwhere clause
to removeIS NULL