0) { $percanalysisfail = round(($num_rows_analysis_fail / $num_rows_analysis) * 100, 1); } else { $percanalysisfail = 0; // Oppure un altro valore di default } //create an array if (!function_exists('replaceSmartQuotes')) { function replaceSmartQuotes($string) { $search = array(chr(145), chr(146), chr(147), chr(148), chr(151)); $replace = array("'", "'", '"', '"', '-'); return str_replace($search, $replace, $string); } } if (!function_exists('replaceSmartQuotesInArray')) { function replaceSmartQuotesInArray($array) { foreach ($array as $key => $value) { if (is_string($value)) { $array[$key] = replaceSmartQuotes($value); } elseif (is_array($value)) { $array[$key] = replaceSmartQuotesInArray($value); } } return $array; } } $reportsarray = array(); while ($row = mysqli_fetch_assoc($result)) { $reportsarray[] = replaceSmartQuotesInArray($row); } //$totalreport= if ((!empty($num_rows)) && (!empty($num_rows_fail))) { $perfail = round(($num_rows_fail / $num_rows) * 100, 1); } if ((!empty($num_rows)) && (!empty($num_rows_data))) { $perdata = round(($num_rows_data / $num_rows) * 100, 1); } if ((!empty($num_rows)) && (isset($num_rows_fail)) && (!empty($num_rows_data))) { $numpassres = ($num_rows - $num_rows_data - $num_rows_fail); } if ((!empty($perfail)) && (!empty($perdata))) { $perpass = round(100 - $perfail - $perdata, 1); } ?> 0) { echo "La query ha restituito dei risultati."; } else { echo "La query non ha restituito risultati."; } $failedAnalytes = array(); while ($row = mysqli_fetch_assoc($resultFailedAnalytes)) { echo "Analita: " . $row['AnalyteName'] . ", Fail Count: " . $row['FailCount'] . "
"; $failedAnalytes[] = [ 'AnalyteName' => $row['AnalyteName'], 'FailCount' => $row['FailCount'] ]; } // Salva i dati per essere utilizzati nel JSON di risposta $data['failedAnalytes'] = $failedAnalytes; echo "
";
print_r($data['failedAnalytes']);
echo "
"; ?>