Please help me, I want to convert a simple SQL statement to Codeigniter
date($fromDate) BETWEEN vehicle_register.start_dt AND vehicle_register.end_dt
Please help me, I want to convert a simple SQL statement to Codeigniter
date($fromDate) BETWEEN vehicle_register.start_dt AND vehicle_register.end_dt
Try this with Method chaining
,
$this->db->select('*');
$this->db->from('yourTableName');
$this->db->where('date('.$fromDate.') >=', 'vehicle_register.start_dt');
// >= will get conditional date too so please keep it as your reqirement
$this->db->where('date('.$fromDate.') <=', 'vehicle_register.end_dt');
$query= $this->db->get();
if($query->num_rows() > 0){
//return $query->result();//according to your need
}else{
//return array();//according to your need
}