<?php

	require_once 'dbconfig.php';
	
	if(isset($_GET['prid']))
	{
		$stmt_select = $DB_con->prepare('SELECT cover FROM mobileproducts WHERE prid =:prid');
		$stmt_select->execute(array(':prid'=>$_GET['prid']));
		$imgRow=$stmt_select->fetch(PDO::FETCH_ASSOC);
		unlink("images/products/cover/".$imgRow['cover']);
		
		$stmt_delete = $DB_con->prepare('DELETE FROM mobileproducts WHERE prid =:prid');
		$stmt_delete->bindParam(':prid',$_GET['prid']);
		$stmt_delete->execute();

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

?>