![]() |
Active Record Class $this->db->like(); - 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: Active Record Class $this->db->like(); (/showthread.php?tid=5582) |
Active Record Class $this->db->like(); - El Forum - 01-27-2008 [eluser]breaddes[/eluser] I was wondering how I can set a Query that machtes the first letter: Code: SELECT * FROM foo WHERE title LIKE 'a%' Actually the Active Record Class produces %a% instead of a% Active Record Class $this->db->like(); - El Forum - 01-27-2008 [eluser]Aea[/eluser] Write that part of your clause manually, I ran into a similar issue with UCASE where the built in active record class was adding in 's in unnecessary places, so I wrote my entire query by hand, just don't forget to escape the data if you don't trust it ![]() Unfortunately, something like Active Record as it's implemented in CI is only good for simpler queries, if what you're trying to do doesn't match the way AR does it, it seems you just have to write that part yourself. Active Record Class $this->db->like(); - El Forum - 01-27-2008 [eluser]xwero[/eluser] grab the SVN AR library.Then you can do Code: $this->db->like('title','a','after'); |