<?php

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

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

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

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

?>