My code in COdeigniter 4 model is as following:
public function check_header($id){
$where_params = [
'a.id' => $id,
'fee_status' => 'applied'
];
return $this->db->table('header a')
->select('*, IF(NOW() BETWEEN a.fee_date_active AND a.fee_date_exp, "applied", "exp") AS fee_status')
->where($where_params)
->orderBy('a.id', 'DESC')
->get()->getResult();
}
The problem is I include fee_status
in the $where_params
where fee_status is generated column from the select query above, returned an error from Codeigniter 4 that told me "Unknown column 'active_status' in 'where clause'"
.
How do I fix it? Thank you.