<?php
	if(isset($_GET['id'])){
		$id = (int) $_GET['id'];
		$sql = "SELECT * FROM cmas_busimg WHERE busimg_id='$id'";
		$result = mysqli_query($koneksi, $sql);
		if(mysqli_num_rows($result) > 0 ){
			$data = mysqli_fetch_array($result);
			@unlink('assets/images/galeri/'.$data['busimg_image']);
			mysqli_query($koneksi, "DELETE FROM cmas_busimg WHERE busimg_id='$id'");
		}
	} 
	if($result) {
		echo "<script>alert('HAPUS FOTO GALERI BERHASIL');history.go(-1);</script>";	
	} else {
		echo "<script>alert('HAPUS FOTO GALERI GAGAL, SILAHKAN COBA KEMBALI !');history.go(-1);</script>";
	}
?>