<?php

	require_once 'dbconfig4.php';
	
	if(isset($_GET['dcid']))
	{

		$stmt_select = $DB_con->prepare('SELECT cover FROM ormsdatacard WHERE dcid =:dcid');
		$stmt_select->execute(array(':dcid'=>$_GET['dcid']));
		$imgRow=$stmt_select->fetch(PDO::FETCH_ASSOC);
		unlink("images/datacard/".$imgRow['image']);

		$stmt_delete = $DB_con->prepare('DELETE FROM ormsdatacard WHERE dcid =:dcid');
		$stmt_delete->bindParam(':dcid',$_GET['dcid']);
		$stmt_delete->execute();

		echo"<script type='text/javascript'>window.location.href = 'datacard.php';</script>";
		
	}

?>