Welcome Guest, Not a member yet? Register   Sign In
Can I use BETWEEN in active record?
#1

[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?
#2

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

[eluser]shinokada[/eluser]
Thanks Phil.




Theme © iAndrew 2016 - Forum software by © MyBB