![]() |
problem in $this->db->or_where() - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: problem in $this->db->or_where() (/showthread.php?tid=41260) Pages:
1
2
|
problem in $this->db->or_where() - El Forum - 05-03-2011 [eluser]Bigil Michael[/eluser] Quote:function get_ordinary_search($search, $category)this is the model function i used to do search. without $this->db->or_where('subcat_id', (int)$category); it is working well when i use the condition $this->db->or_where('subcat_id', (int)$category); it shows every fields in the table can anyone help me???/ is there any syntax problem.... please reply thanks in advance.. problem in $this->db->or_where() - El Forum - 05-03-2011 [eluser]Sudz[/eluser] Now Try this one Code: function get_ordinary_search($search, $category) problem in $this->db->or_where() - El Forum - 05-03-2011 [eluser]Bigil Michael[/eluser] problem is not solved when i use Quote:$this->db->or_where('subcat_id', (int)$category); like statement is not working can anyone help me urgent...... problem in $this->db->or_where() - El Forum - 05-03-2011 [eluser]danmontgomery[/eluser] AR doesn't group where clauses at all. So, your query says: Code: SELECT * FROM `classifieds` WHERE `featured` = 1 AND `status` = 1 AND `cat_id` = $category OR `subcat_id` = $category which will give you any thing with subcat_id = $category. You need to manually write the where clause if you want it grouped. Code: if($search!=‘all’){ problem in $this->db->or_where() - El Forum - 05-03-2011 [eluser]Bigil Michael[/eluser] but it shows no result problem in $this->db->or_where() - El Forum - 05-03-2011 [eluser]danmontgomery[/eluser] so use: Code: $this->output->enable_profiler(); problem in $this->db->or_where() - El Forum - 05-03-2011 [eluser]Sudz[/eluser] Put you or_where condition first then try it. like this Code: function get_ordinary_search($search, $category) problem in $this->db->or_where() - El Forum - 05-03-2011 [eluser]Bigil Michael[/eluser] but it will not echo the query i applied like this Quote:function get_ordinary_search($search, $category)and it shows some error problem in $this->db->or_where() - El Forum - 05-03-2011 [eluser]Bigil Michael[/eluser] Quote:function get_ordinary_search($search, $category)it also has same problem problem in $this->db->or_where() - El Forum - 05-03-2011 [eluser]Bigil Michael[/eluser] can anyone help me???? urgent..... |