![]() |
where() and like() are not working together - 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: where() and like() are not working together (/showthread.php?tid=50335) |
where() and like() are not working together - El Forum - 03-22-2012 [eluser]Nartub[/eluser] Hello. I'm trying to make a query which goes: Code: $this->db->where('column1','match1'); and when I get() it, the where clause is not working. Could it be because the like() is adding another WHERE? Thanks in advance. where() and like() are not working together - El Forum - 03-22-2012 [eluser]CroNiX[/eluser] Try changing the order. Sometimes it matters. where() and like() are not working together - El Forum - 03-22-2012 [eluser]Nartub[/eluser] Ahh I've found the problem. Thing is like this: Code: $this->db->where('column1', 'match1'); So the query is: Code: ...WHERE column1 = match1 AND column2 LIKE match2 OR column3 LIKE match2 OR column4 LIKE match2 But it should be: Code: ...WHERE column1 = match1 AND (column2 LIKE match2 OR column3 LIKE match2 OR column4 LIKE match2) Is there any way to do this? Thanks! where() and like() are not working together - El Forum - 03-22-2012 [eluser]CroNiX[/eluser] Not in this version. There is in the next version with grouping that you can download on github. where() and like() are not working together - El Forum - 03-22-2012 [eluser]Nartub[/eluser] Awesome, thank you very much. |