i have a codeigniter website, where i am trying to display some dates using below code:
function searchstatus($clients,$fromdate,$todate,$deliveryboy)
{
$this->db->where('date >=', $fromdate);
$this->db->where('date <=', $todate);
if ($clients) {
$this->db->like('customer', $clients);
}
if ($deliveryboy) {
$this->db->like('deliveryboy', $deliveryboy);
}
$this->db->order_by('date','ASC');
$query = $this->db->get('delivered');
return $query->result();
}
my table is like below:
however one date is being missed here '2022-06-22'
can anyone please tell me what could be wrong in here, thanks in advance
CodePudding user response:
I think the issue to displaying dates in between, is in your like() clause, please try bellow code it's work for me.
$this->db->where("( date >='".$fromdate."' AND date <='". $todate."')");
CodePudding user response:
$this->db->where("( date >='".$fromdate."' AND date <='". $todate."')"); use your table column name