<?php
include("tamu_postdb.php");
$id1 = $_GET["id"];
$filetarget1 = $_GET["file"];
// Create connection
$conn = new mysqli($server, $username, $password, $database);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// sql to delete a record
$sql = "DELETE FROM $mytable WHERE tamu_id =$id1";

if ($conn->query($sql) === TRUE) {
    echo "<a href=\"index.tamu.php?g=bukutamu&i=index\" class=\"menu\">BERHASIL MENGHAPUS  KLIK UNTUK KEMBALI</a>";
	//unlink($filetarget1); //dihapus
} else {
    echo "Error deleting record: " . $conn->error;
}
if (file_exists($filetarget1)) {
unlink($filetarget1); //dihapus
if (file_exists($filetarget1)) {
echo "Bermasalah saat menghapus File Lakukan secara Manual pada direktori" .$filetarget1;
} else {
echo "Berhasil menghapus File" .$filetarget1;
}
}
$conn->close();
?> 