CodeIgniter Forums

Full Version: Active Record Class $this->db->like();
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

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

El Forum

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

El Forum

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