CodeIgniter Forums
where_in null and 1 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: where_in null and 1 (/showthread.php?tid=73232)



where_in null and 1 - ulas - 04-03-2019

->where_in('Login',array(null,1))

not working pls help me.


RE: where_in null and 1 - php_rocs - 04-03-2019

@ulas,

We need more info then that. Is the query not returning data? Can we see the rest of the query? What are you expecting the query to return?


RE: where_in null and 1 - adamoli - 04-03-2019

This looks more of a mysql question. I don't think you can use NULL inside a WHERE IN clause.
Try 'WHERE Login = 1 OR Login IS NULL'

You could use $db->get_compiled_select() to see how CI has constructed the query and then try and make it work in phpmyadmin or whatever.


RE: where_in null and 1 - ulas - 04-04-2019

found solution;

->group_start()
->where(array('Login'=>null))
->or_where(array('Login'=>1))
->group_end()

thank you!