I want to get count of records saved on the current date using following approach can anybody help me what is wrong with the code. My Code always returning Zero result first block of case statement is not working for date.
$date = new DateTime("now");
$curr_date = $date->format("Y-m-d");
$this->db->select("case when DATE(created_at) = '$curr_date' then count(*) else 0 end as records_fed_today");
$this->db->from("my_table");
$query = $this->db->get();
return $query->result();