query($query); $tableData = []; // Array per la tabella while ($row = $result->fetch_assoc()) { $substances[] = $row['substance_name']; $passCounts[] = $row['pass_count']; $failCounts[] = $row['fail_count']; $substanceIds[] = $row['substance_id']; // Aggiungi l'ID della sostanza // Aggiungi dati al $tableData per la tabella $tableData[] = [ 'id' => $row['substance_id'], 'name' => $row['substance_name'], 'pass_count' => $row['pass_count'], 'fail_count' => $row['fail_count'], 'total' => $row['pass_count'] + $row['fail_count'] ]; } $queryDetectable = " SELECT cv.idcompoundsvocabulary AS substance_id, cv.namecompoundsvocabulary AS substance_name, cv.cascompoundvocabulary AS cas_number, COUNT(*) AS total_results, COUNT(CASE WHEN rp.result_Value NOT LIKE '<%' THEN 1 END) AS detectable_count, ROUND((COUNT(CASE WHEN rp.result_Value NOT LIKE '<%' THEN 1 END) / COUNT(*)) * 100, 2) AS detectable_percentage FROM result_project rp LEFT JOIN analysis_project ap ON rp.idanalysis_project = ap.idAnalysis_Project LEFT JOIN compundsvocabulary cv ON rp.result_AnalytsName = cv.idcompoundsvocabulary WHERE cv.preferred = 'Y' AND cv.component_type = 'CH' GROUP BY cv.idcompoundsvocabulary, cv.namecompoundsvocabulary, cv.cascompoundvocabulary ORDER BY total_results DESC; "; $resultDetectable = $conn->query($queryDetectable); $detectableData = []; // Array per la nuova tabella while ($row = $resultDetectable->fetch_assoc()) { $detectableData[] = [ 'id' => $row['substance_id'], 'name' => $row['substance_name'], 'cas_number' => $row['cas_number'], // Aggiunge il CAS number 'total_results' => $row['total_results'], 'detectable_count' => $row['detectable_count'], 'detectable_percentage' => $row['detectable_percentage'] ]; } ?>

Substance Statistics

records
Substances by Rating
Substances Data
Substance Name Pass Count Fail Count Total
Chemical Substance Result Summary
Substance Name CAS Number Total Results Detectable Count Detectable %
%