CodeIgniter Forums
Can I use BETWEEN in active record? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Can I use BETWEEN in active record? (/showthread.php?tid=26634)



Can I use BETWEEN in active record? - El Forum - 01-19-2010

[eluser]shinokada[/eluser]
I want to convert the following to active record.

How can I do it?

Code:
$query = $this->db->query("SELECT DATE_FORMAT(eventDate,'%d')
AS day,eventContent,eventTitle,id,user,user_id
FROM eventcal
WHERE eventDate
BETWEEN  '$current_year/$current_month/01'
AND '$current_year/$current_month/$total_days_of_current_month'");

Can I use BETWEEN in the active record?


Can I use BETWEEN in active record? - El Forum - 01-19-2010

[eluser]Phil Sturgeon[/eluser]
Sadly it's only possible via:

Code:
$this->db->where("eventDate BETWEEN '$current_year/$current_month/01' AND '$current_year/$current_month/$total_days_of_current_month'", '', FALSE);

Between is not a generic SQL feature so ActiveRecord does not support it.


Can I use BETWEEN in active record? - El Forum - 01-19-2010

[eluser]shinokada[/eluser]
Thanks Phil.