如何计算所有条件为 Date Now

How to Count all with condition Date Now

我尝试用日期条件计算我网站中的所有行,但我不知道为什么我的代码仍然不起作用。我尝试在我的专栏前面添加(日期)(created_at),但结果:

error "Message: Call to a member function num_rows() on boolean"

这是我的代码:

    public function hitungPerbaikan()
    {
        $date = new DateTime('now');
        $curr_date = $date->format('Y-m-d');
        $this->db->where('update_at', $curr_date);
        $this->db->where('status >=', '2'); 
        $this->db->from('tbl_kerusakan');
        return $this->db->count_all_results();
    }

感谢您的建议,它真的帮助我弄明白了,这是我现在的代码

public function hitungPerbaikan()
{
    $date = new DateTime('now');
    $curr_date = $date->format('ymd');
    $this->db->where('update_at>=', $curr_date);
    $this->db->where('status >=', '2');
    $this->db->from('tbl_kerusakan');
    $db_result = $this->db->get();
    return $db_result->num_rows();
}