Welcome Guest, Not a member yet? Register   Sign In
Active Record Class $this->db->like();
#1

[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%
#2

[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 Smile

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.
#3

[eluser]xwero[/eluser]
grab the SVN AR library.Then you can do
Code:
$this->db->like('title','a','after');




Theme © iAndrew 2016 - Forum software by © MyBB