prepare("INSERT INTO videos (title, description, release_date, source_type, video_url, thumbnail_url, uploader_id) VALUES (?, ?, ?, ?, ?, ?, ?)"); if ($stmt->execute([$title, $description, $release_date, $source_type, $video_url, $thumbnail_url, $_SESSION['user_id']])) { $video_id = $pdo->lastInsertId(); if (!empty($_POST['tags'])) { $tags = explode(',', $_POST['tags']); foreach ($tags as $tag_name) { $tag_name = trim($tag_name); if (!$tag_name) continue; $pdo->prepare("INSERT IGNORE INTO tags (name) VALUES (?)")->execute([$tag_name]); $tag_stmt = $pdo->prepare("SELECT id FROM tags WHERE name = ?"); $tag_stmt->execute([$tag_name]); $tag_id = $tag_stmt->fetchColumn(); $pdo->prepare("INSERT IGNORE INTO video_tags (video_id, tag_id) VALUES (?, ?)")->execute([$video_id, $tag_id]); } } $success = "Video added successfully!"; } else { $error = "Database error. Could not add video."; } } } // Reuse header by adjusting paths ob_start(); require_once '../includes/header.php'; $header = ob_get_clean(); echo str_replace(['assets/', 'index.php', 'login.php', 'logout.php', 'admin/'], ['../assets/', '../index.php', '../login.php', '../logout.php', './'], $header); ?>

Add New Sermon

Max size:
Recommended: 1280x720 (16:9)
Cancel