title: Following code displaying NAN and INF value on screen
body: <p>Following code displaying INF and NAN value on screen when displaying values from mysql. I ran the query in mysql and I was able to get the desired values but on the web page while returning the values I get the above values.</p>
  
  <pre><code>function get_preelections_results_public(){
      global $mysqli;
      $return_data = "";
      $squery = "SELECT 'PreElection', (SELECT count(pu_name) from polling_unit) pu_count, (SELECT count( distinct pu_name) from pre_election_check_info) pu_reported_count,(SELECT count(distinct pu_name) from pre_election_check_info a WHERE inec_arrival_status='Yes' and security_arrival_status='Yes' and entry_date = (select max(entry_date) from pre_election_check_info b where a.pu_name=b.pu_name)) green_count,
      (SELECT count(distinct pu_name) from pre_election_check_info a WHERE inec_arrival_status ='Yes' and security_arrival_status ='No' and entry_date = 
      (select max(entry_date) from pre_election_check_info b where a.pu_name=b.pu_name)) amber_count_1, (SELECT count(distinct pu_name) from pre_election_check_info a WHERE inec_arrival_status ='No' and security_arrival_status ='Yes' and entry_date = (select max(entry_date) from pre_election_check_info b where a.pu_name=b.pu_name)) amber_count_2, (SELECT count(distinct pu_name) from pre_election_check_info a WHERE inec_arrival_status ='No' and security_arrival_status ='No' and entry_date = (select max(entry_date) from pre_election_check_info b where a.pu_name=b.pu_name)) red_count
      FROM pre_election_check_info LIMIT 1";
      $sresult = mysqli_query($mysqli, $squery) or die(mysqli_error($mysqli));
      $numrows = mysqli_num_rows($sresult);
      $total_pu_count = 0;
      $total_reported_pu_count = 0;
      $count_green_status = 0;
      $count_yes_no_status = 0;
      $count_no_yes_status = 0;
      $count_red_status = 0;
      $count_none_status = 0;
      if($row = mysqli_fetch_array($sresult)){
          $total_pu_count = $row["pu_count"]; 
          $total_reported_pu_count = $row["pu_reported_count"];
          $count_green_status = $row["green_count"];
          $count_yes_no_status = $row["amber_count_1"];
          $count_no_yes_status = $row["amber_count_2"];
          $count_red_status = $row["red_count"];
          $count_none_status = $total_pu_count - $total_reported_pu_count;
  
          $green_status_percent = $count_green_status/$total_pu_count * 100;
          $amber_status_percent = ($count_yes_no_status+$count_no_yes_status)/$total_pu_count * 100;
          $red_status_percent = $count_red_status/$total_pu_count * 100;
          $none_status_percent = $count_none_status/$total_pu_count * 100;
          $red_status_percent+=$none_status_percent;
  
          $return_data .="Green,".$green_status_percent.";";
          $return_data .="Amber,".$amber_status_percent.";";
          $return_data .="Red,".$red_status_percent.";";
          //$return_data .="None,".$none_status_percent.";";
      }
      return rtrim($return_data,";");
  }
  </code></pre>
  
  <p>What I am getting when results is being displayed;</p>
  
  <p><strong>Green,INF;Amber,NAN;Red,NAN</strong> </p>