$query="select count(appointment_id) from employee_appointment where date(appointment_date) >= '".$default_start_date."' and date(appointment_date) <= '".$default_end_date."' and (ailment_systems_new='$total_ailment_count[$i]' or ailment_systems_new like '%,$total_ailment_count[$i]%' or ailment_systems_new like '%,$total_ailment_count[$i],%' or ailment_systems_new='%$total_ailment_count[$i],%' ) and appointment_type='O' and department='".$dept_id."'";
error_log("opd chart ailment with dept ".$query);
if(!$result=@mysqli_query($conn,$query)){
error_log("error in opd chart ailment with dept ".mysqli_error($conn));