<?php 
        require_once "DBConfig.php";
 		$id = $_REQUEST['key']; 
		$u = $_REQUEST['u'];
			$sql = "DELETE FROM gallery WHERE ga_id='".$id."'";
						if ($link->query($sql) === TRUE) 
						{
						echo "<script type='text/javascript'> window.onload = function () { alert('Image deleted successfully!');	   					
				window.location.href='Gallery.php?u=$u';} </script>"; 
						}
						else 
						{
						
						echo "<script type='text/javascript'> window.onload = function () { alert('Error: Please try again later!');	   					
				window.location.href='Gallery.php?u=$u';} </script>"; 
							
						}
?>