<?php

$query=$db->prepare("SELECT * FROM video order by id ASC");
$query->execute();

$theme = $settings["theme"];

if(isset($_POST["deletevideo"])){
	$delproduct = $_POST["deletevideo"];
	foreach($delproduct as $deletevideo){
		$sor = $db->prepare("SELECT * FROM video WHERE id=:id");
		$sor->execute(array(
			'id' => $deletevideo
		));
		$cek=$sor->fetch(PDO::FETCH_ASSOC);
		$image=PATH . "/public/{$theme}/{$cek['image']}";
		$delete = $db->prepare("DELETE FROM video WHERE id = ?");
		$delete->execute(array($deletevideo));
		if($delete){
			@unlink("$image");
			$success = 'İşlem başarıyla gerçekleşti.';
		}else{
			$error = 'Bir hata oluştu.';
		}
	}
}

require admin_view('video-listele');