Home > database >  Between Condition is not working on server side
Between Condition is not working on server side

Time:01-12

Between Condition is not working on server side

$this->db->group_start();
$this->db->where('("'.$start_date.'" BETWEEN start_date AND end_date)', NULL, FALSE);
$this->db->or_where('("'.$end_date.'" BETWEEN start_date AND end_date)', NULL, FALSE);
$this->db->group_end();

This Between Condition is working on local but not on server side

CodePudding user response:

maybe you database from server vs local doesn't have the same data, or maybe different format of dates to validate.

CodePudding user response:

Put this Condition

('SELECT id FROM bookings WHERE id = "'.$caretaker_id.'" AND booking_status = "Active" AND ((booking_start_date <= "'.$start_date.'" AND booking_end_date >= "'.$start_date.'") OR (booking_start_date <= "'.$end_date.'" AND booking_end_date >= "'.$end_date.'"));');

  • Related