Can't I use db->where and db->like together? |
[eluser]esset[/eluser]
Hey I'm trying to do this using the Active Record class. Code: $this->db->where(foo); Why when I run this is my WHERE statement ignored? I wan't it to produce: Code: SELECT * FROM foo WHERE foo = foo AND foo LIKE '%%' OR foo LIKE '%%'
[eluser]toopay[/eluser]
Above AR will generates your needs, nothing wrong with that, but i guess, you expect a query like this Code: SELECT * FROM foo_table WHERE foo = 'bar' AND (foo LIKE '%b%' OR foo LIKE '%ar%')
[eluser]esset[/eluser]
Ah yes stupid me. I just couldn't figure out why it wasn't working. Got code-blind Is there a workaround way I could achieve this with AR anyways, like this? Code: $this->db->where(foo); ?
[eluser]toopay[/eluser]
The CI ActiveRecord not supported for grouped WHERE (like you experienced) and sub-query.
[eluser]osci[/eluser]
OR vs. AND in Active Record LIKE query And I don't think it's not supported, seems more to me like a bug, a minor one, but still a bug. Edit: sorry, misread the thread, toopay is right about nested queries |
Welcome Guest, Not a member yet? Register Sign In |