<?php

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

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

?>