connect_error) { die("Connessione al database fallita: " . $conn->connect_error); } // Esegui l'aggiornamento per impostare phototwo a NULL $query = "UPDATE `trf-details` SET phototwo = NULL WHERE idtrfdetails = ?"; $stmt = $conn->prepare($query); $stmt->bind_param("i", $idtrf); $stmt->execute(); if ($stmt->affected_rows > 0) { error_log("Successfully updated phototwo to NULL for idtrfdetails = $idtrf"); } else { error_log("Failed to update phototwo for idtrfdetails = $idtrf"); } $stmt->close(); $conn->close(); // Reindirizza alla pagina principale header("Location: adddocument.php?idtrf=$idtrf&t=" . time()); exit; } else { // Se idtrf non รจ valido, reindirizza header("Location: index.php"); exit; }