<?php

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

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

?>