Codeigniter: Using Active Record to search for rows between two dates?
Is there a way to use codeigniters active record system to construct a query that will search for rows that fall between two dates (rows has an added field and I want to supply the query a start and end date)?
I have checked the documentation knowing that mysql inc开发者_运维知识库ludes a between keywork for such things but can't see anything related to it.
Thanks in advance
You can just use two where()
methods. They will be bound via AND
, so if the first is 'everything after' and the second is 'everything before', you get a 'everything in between'.
If you want to use SQL goodies like NOW()
, use where()
s third parameter, and set it to False
.
精彩评论