= '" . $default_start_date . "' and date(checkup_date) <= '" . $default_end_date . "' and checkup_type_id= '" . $total_medical_exam[$i] . "' and p.patient_cat_id='".$cat."' "; error_log(" medical query " . $query); if (!$result = @mysqli_query($conn, $query)) { error_log("error in medical 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("medical data trend " . print_r($checkup_data, true)); $data = array( 'checkup_data' => ($checkup_data), 'medical_exam_name' => ($total_medical_exam_name), ); echo json_encode($data);