<?php

	require_once 'dbconfig.php';
	
	if(isset($_GET['branch_id']))
	{
		
		$stmt_select = $DB_con->prepare('SELECT logo FROM branch WHERE branch_id =:branch_id');
		$stmt_select->execute(array(':branch_id'=>$_GET['branch_id']));
		$imgRow=$stmt_select->fetch(PDO::FETCH_ASSOC);
		unlink("images/branch/".$imgRow['logo']);
		
		$stmt_delete = $DB_con->prepare('DELETE FROM branch WHERE branch_id =:branch_id');
		$stmt_delete->bindParam(':branch_id',$_GET['branch_id']);
		$stmt_delete->execute();
		
		//header("Location: category.php");
		echo"<script type='text/javascript'>window.location.href = 'branchlist.php';</script>";
		
	}

?>