<?php

$id = $_GET['idhapus'];

$datagambar = $koneksi->query("SELECT profil_foto From tbl_profil WHERE profil_id = '$id'")->fetch_assoc();
$gambar = $datagambar['profil_foto'];

unlink("dist/img/imgprofil/" . $gambar);
$koneksi->query("DELETE FROM tbl_profil WHERE profil_id='$id'");

echo "<script>
       alert('Data Berhasil Di Hapus');
       window.location='?page=pages/profil/view'
       </script>";
