<?php

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

$theme = $settings["theme"];

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

require admin_view('yakis-listele');