='".$start_date."' "; //$qry_date.=" and checkup_date >=str_to_date('".$start_date."','%d-%m-%Y') "; } if(isset($end_date) && $end_date!=''){ //$qry_date.=" and checkup_date <='".$end_date."' "; //s $qry_date.=" and checkup_date <=str_to_date('".$end_date."','%d-%m-%Y') "; }*/ // $query="SELECT year(doj) as yr FROM patient_master"; // if (!$result = @mysqli_query($conn,$query)) { // exit(mysqli_error($conn)); // } // if(mysqli_num_rows($result) > 0) { // while ($row = @mysqli_fetch_array($result)) { // if($row['yr'] == '2016'){ // $yr1 = $row['inj_class_id']; // }elseif($row['inj_class_name'] == 'LTI'){ // $lti_id = $row['inj_class_id']; // }elseif($row['inj_class_name'] == 'HOSPITALIZATION'){ // $hos_id = $row['inj_class_id']; // }elseif($row['inj_class_name'] == 'MINOR'){ // $min_id = $row['inj_class_id']; // } // } // } else { // echo '0'; // } $year = array("2021","2020","2019","2018"); $data = array(); for($i=0;$i 0) { if ($row = mysqli_fetch_assoc($result)) { $data['count'][$year[$i]] = $row; } } // $query="SELECT count(*) as total FROM patient_master where YEAR(CURDATE())-year(dob)>=26 and YEAR(CURDATE())-year(dob)<=30 $qry_date and year(doj) like '".$year[$i]."'"; // error_log("fdhkdjhf".$query); // if (!$result = @mysqli_query($conn,$query.$qry_bu)) { // exit(mysqli_error($conn)); // } // if(mysqli_num_rows($result) > 0) { // if ($row = mysqli_fetch_assoc($result)) { // $data['age_26_30'][$year[$i]] = $row; // } // } // $query="SELECT count(*) as total FROM patient_master where YEAR(CURDATE())-year(dob)>=31 and YEAR(CURDATE())-year(dob)<=40 $qry_date and year(doj) like '".$year[$i]."'"; // error_log("fdhkdjhf".$query); // if (!$result = @mysqli_query($conn,$query.$qry_bu)) { // exit(mysqli_error($conn)); // } // if(mysqli_num_rows($result) > 0) { // if ($row = mysqli_fetch_assoc($result)) { // $data['age_31_40'][$year[$i]] = $row; // } // } // $query="SELECT count(*) as total FROM patient_master where YEAR(CURDATE())-year(dob)>=41 and YEAR(CURDATE())-year(dob)<=50 $qry_date and year(doj) like '".$year[$i]."'"; // error_log("fdhkdjhf".$query); // if (!$result = @mysqli_query($conn,$query.$qry_bu)) { // exit(mysqli_error($conn)); // } // if(mysqli_num_rows($result) > 0) { // if ($row = mysqli_fetch_assoc($result)) { // $data['age_41_50'][$year[$i]] = $row; // } // } // $query="SELECT count(*) as total FROM patient_master where YEAR(CURDATE())-year(dob)>50 and year(doj) like '".$year[$i]."'"; // error_log("fdhkdjhf".$query); // if (!$result = @mysqli_query($conn,$query.$qry_bu)) { // exit(mysqli_error($conn)); // } // if(mysqli_num_rows($result) > 0) { // if ($row = mysqli_fetch_assoc($result)) { // $data['age_more50'][$year[$i]] = $row; // } // } } $query="SELECT count(*) as total FROM patient_master "; $qry_bu=preg_replace('/and/', 'where', $qry_bu, 1); //echo $query.$qry_bu; if (!$result = @mysqli_query($conn,$query.$qry_bu)) { exit(mysqli_error($conn)); } if(mysqli_num_rows($result) > 0) { if ($row = mysqli_fetch_assoc($result)) { $data['total_count'] = $row; } } echo json_encode($data); ?>