='".$start_date."' "; // $qry_date.=" and medical_entry_date >=str_to_date('".$start_date."','%d-%m-%Y') "; // } // if(isset($end_date) && $end_date!=''){ // //$qry_date.=" and checkup_date <='".$end_date."' "; // $qry_date.=" and medical_entry_date <=str_to_date('".$end_date."','%d-%m-%Y') "; // } // $i=0; // $weight =array(1,2,3,4,5,-1,-2,-3,-4,-5,0); $data=""; $year=$_POST['year']; error_log($year); for($i=1;$i<=12;$i++){ $month_name =substr(date("F", mktime(0, 0, 0, $i, 10)), 0, 3); $query="select SUBSTRING( MONTHNAME(STR_TO_DATE(10, '%m')), 1, 3 ) as month,YEAR(waste_gen_date) as year,sum(plant_yellow_qty) as plant_yellow,sum(mines_yellow_qty) as mines_yellow,sum(yellow_qty_total) as yellow_qty,sum(plant_white_qty) as plant_white,sum(mines_white_qty) as mines_white,sum(white_qty_total) as white_qty,sum(plant_blue_qty) as plant_blue,sum(mines_blue_qty) as mines_blue,sum(blue_qty_total) as blue_qty,sum(plant_red_qty) as plant_red,sum(mines_red_qty) as mines_red,sum(red_qty_total) as red_qty from bio_medical_waste_new WHERE year(waste_gen_date) =$year AND month(waste_gen_date)=$i group by date_format(waste_gen_date, '%M') ORDER BY `year` ASC "; error_log($query); $result=mysqli_query($conn,$query); $total=mysqli_num_rows($result); error_log($total); if($total!=0){ while($row=mysqli_fetch_assoc($result)){ $array1 = array($row['year'],$row['month'],$row['plant_yellow'],$row['mines_yellow'],$row['yellow_qty'],$row['plant_white'],$row['mines_white'],$row['white_qty'],$row['plant_blue'],$row['mines_blue'],$row['blue_qty'],$row['plant_red'],$row['mines_red'],$row['red_qty']); $data[]=$array1; // $data.="