0) { while ($row = @mysqli_fetch_array($result)) { array_push($xaxis,$i); array_push($opd,$row[0]); } } else { echo '0'; } } for($i=0; $i<=11; $i++){ $query="SELECT COUNT(appointment_id) FROM employee_appointment WHERE MONTH(appointment_date) = $i and year(appointment_date) = '$year' AND appointment_type='I' AND emp_id='$id' "; // echo $query; if (!$result = @mysqli_query($conn,$query)) { exit(mysqli_error($conn)); } if(mysqli_num_rows($result) > 0) { while ($row = @mysqli_fetch_array($result)) { array_push($injury,$row[0]); } } else { echo '0'; } } for($i=0; $i<=11; $i++){ $query="SELECT COUNT(sickness_id) FROM sickness WHERE MONTH(sickness_date) = $i and year(sickness_date) = '$year'AND emp_id='$id' "; // echo $query; if (!$result = @mysqli_query($conn,$query)) { exit(mysqli_error($conn)); } if(mysqli_num_rows($result) > 0) { while ($row = @mysqli_fetch_array($result)) { array_push($sickness,$row[0]); } } else { echo '0'; } } ?>