I only want the dates starting from the current date. How do I ask this in CodeIgniter? “end_date” is a DATETIME (Y-m-d H:i:s).
This isn’t working:
$this->db->select("DATE(end_date) as my_end_date", FALSE);
$this->db->where('my_end_date >', date());
$q = $this->db->get('tblTest');
You need to format the date in PHP so that it’s in the format MySQL wants.
Try this:
You can also use MySQL’s
NOW()for this.EDIT: If you want to use the alias
my_end_date, you can use HAVING instead of WHERE.