Primo commit: trasferimento del progetto PPEasy
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
include('include/headscript.php'); ?>
|
||||
<?php
|
||||
// connessione al database
|
||||
$conn = mysqli_connect($hostname_cmctrfdb, $username_cmctrfdb, $password_cmctrfdb, $database_cmctrfdb);
|
||||
if (!$conn) {
|
||||
die("Connessione al database fallita: " . mysqli_connect_error());
|
||||
}
|
||||
|
||||
// Controllo dei campi nulli
|
||||
$sql = "SELECT COUNT(*) AS num_rows FROM trfstandards WHERE idtrfdetails = $idtrf AND (idprotectioncategory IS NULL OR iddpicategory IS NULL)";
|
||||
$resultcat = mysqli_query($conn, $sql);
|
||||
// Controllo degli errori
|
||||
if (!$resultcat) {
|
||||
die("Errore nella query: " . mysqli_error($conn));
|
||||
}
|
||||
$row = mysqli_fetch_assoc($resultcat);
|
||||
|
||||
if ($row['num_rows'] > 0) {
|
||||
// Campi nulli trovati, restituisci la risposta JSON con flag false e il messaggio di errore
|
||||
$response = array(
|
||||
'success' => false,
|
||||
'message' => 'Non hai compilato la categoria di protezione e categoria DPI per tutti gli standards.'
|
||||
);
|
||||
} else {
|
||||
// Tutti i campi sono compilati, restituisci la risposta JSON con flag true e il messaggio di successo
|
||||
$response = array(
|
||||
'success' => true,
|
||||
'message' => 'Tutte le categorie sono state compilate.'
|
||||
);
|
||||
}
|
||||
|
||||
// Restituisci la risposta JSON
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($response);
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user