= '" . $default_start_date . "' and date(e.appointment_date) <= '" . $default_end_date . "' and appointment_type='O' and p.patient_cat_id='" . $total_patient_count[$i] . "' "; if (!$result = @mysqli_query($conn, $query)) { error_log("error in opd chart" . mysqli_error($conn)); exit(); } if (mysqli_num_rows($result) > 0) { while ($row = @mysqli_fetch_array($result)) { array_push($checkup_data, $row[0]); // array_push($date_data, $row[1]); } } else { array_push($checkup_data, 0); } } error_log("opd cat data trend " . print_r($checkup_data, true)); $data = array( 'checkup_data' => ($checkup_data), 'total_patient_cat' => ($total_patient_cat), ); echo json_encode($data);