<?php

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

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

?>