Between Clause in where condition |
[eluser]Unknown[/eluser]
Hello, I m looking for Between clause in db_active_rec, I found nothing for the same, can any one tell me is there anything written in CodeIgniter for range search. I m looking for a function which will generate following query: select id, name from emp where id between 100 and 200. Is there anything for the same? Lokesh
[eluser]MikeHibbert[/eluser]
try: Code: $this->db->where("id BETWEEN 100 AND 200"); that should sort it out Mike
[eluser]Unknown[/eluser]
Thanks Mike, I have this option with me but i m looking for a function like where_in, because as per my framework, i have to generate query at run time. Lokesh
[eluser]darkhouse[/eluser]
I've actually wanted a feature like this, so that I could do something like Code: $this->db->where_between('id', 100, 200); Though I've just done what Mike said to do and never had a problem. I don't think it's a simple feat to extend the active record class, but what if you made a helper function that was like this: Code: function where_between($field, $min, $max){
[eluser]MikeHibbert[/eluser]
yeah I agree. I have written code on more than one occasion to do that sort of thing. Maybe it something to add. Mike
[eluser]Unknown[/eluser]
You can refer to http://www.cikewang.com/thread-115-1-1.html |
Welcome Guest, Not a member yet? Register Sign In |