prepare(' UPDATE experiences SET title = :title, status = :status, xptype = :xptype, tags = :tags, description = :description, duration = :duration, image_url = :image_url, markdown = :markdown, link_url = :link_url WHERE id = :id '); $stmt->bindValue(':title', $title, PDO::PARAM_STR); $stmt->bindValue(':status', $status, PDO::PARAM_STR); $stmt->bindValue(':xptype', $xptype, PDO::PARAM_STR); $stmt->bindValue(':tags', $tags, PDO::PARAM_STR); $stmt->bindValue(':description', $description, PDO::PARAM_STR); $stmt->bindValue(':duration', $duration, PDO::PARAM_STR); $stmt->bindValue(':image_url', $imageurl, PDO::PARAM_STR); $stmt->bindValue(':markdown', $markdown, PDO::PARAM_STR); $stmt->bindValue(':link_url', $link_url, PDO::PARAM_STR); $stmt->bindValue(':id', $id, PDO::PARAM_INT); $stmt->execute(); // Sinon on renvoie l'erreur if ($updatePdf) { if ($pdfData !== null) { // Nouveau PDF envoyé : on remplace l'éventuel PDF existant (clé primaire = experience_id) $stmtPdf = $dbh->prepare(' INSERT INTO experience_pdfs (experience_id, pdf_filename, pdf_data) VALUES (:id, :pdf_filename, :pdf_data) ON DUPLICATE KEY UPDATE pdf_filename = VALUES(pdf_filename), pdf_data = VALUES(pdf_data) '); $stmtPdf->bindValue(':id', $id, PDO::PARAM_INT); $stmtPdf->bindValue(':pdf_filename', $pdfFilename, PDO::PARAM_STR); $stmtPdf->bindValue(':pdf_data', $pdfData, PDO::PARAM_LOB); $stmtPdf->execute(); } else { // Case "Supprimer ce PDF" cochée, sans nouveau fichier envoyé $stmtPdf = $dbh->prepare('DELETE FROM experience_pdfs WHERE experience_id = :id'); $stmtPdf->bindValue(':id', $id, PDO::PARAM_INT); $stmtPdf->execute(); } } } catch (PDOException $e) { die("Erreur lors de la modification de l experience :" . $e->getMessage()); } // Log Discord sendLog("Modification de l'expérience : " . $title . " (id " . $id . ")"); // On renvoie l'utilisateur sur admin.php header('Location: ../pages/admin.php'); exit;