setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare("UPDATE scc24 SET `type` = :type, `title` = :title, `slug` = :slug, `content` = :content WHERE `id` = :getID"); $stmt->bindParam(':getID', $getID); $stmt->bindParam(':type', $_POST['type']); $stmt->bindParam(':title', $_POST['title']); $stmt->bindParam(':slug', $_POST['slug']); $stmt->bindParam(':content', $_POST['content']); $stmt->execute(); // echo ""; if ($contentType === 'page') { $contentFolder = '/'; } elseif ($contentType === 'notice') { $contentFolder = '/notice/'; } else { $contentFolder = ''; // Default case, you can adjust this as needed } $filePath = $_SERVER['DOCUMENT_ROOT'] . $contentFolder . $fileName; // echo $filePath; if (file_exists($filePath)) { if (unlink($filePath)) { // echo "File deleted successfully."; } else { // echo "Error: Unable to delete the file."; } } else { // echo "File does not exist."; } } catch (PDOException $e) { echo "Err: " . $e->getMessage(); } } ?> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $db->prepare("SELECT * FROM scc24 WHERE `id` = :id"); $stmt->bindParam(':id', $getID); $stmt->execute(); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); foreach($rows as $row){ echo '

Edit New Page or Notice

'; ?>
Page Title:

'; echo ''; }; // exit(); } catch (PDOException $e) { echo json_encode(array('success' => false, 'message' => 'Database error: ' . $e->getMessage())); } ?>