37 lines
1.0 KiB
PHP
37 lines
1.0 KiB
PHP
<?php
|
|
include('../../config.php');
|
|
|
|
$id = $_GET['id'];
|
|
$query = "DELETE FROM pemasok WHERE id_pemasok='$id'";
|
|
|
|
echo "<script src='https://cdn.jsdelivr.net/npm/sweetalert2@11'></script>";
|
|
|
|
if (mysqli_query($conn, $query)) {
|
|
echo "<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
Swal.fire({
|
|
icon: 'success',
|
|
title: 'Berhasil',
|
|
text: 'Pemasok berhasil dihapus',
|
|
confirmButtonText: 'OK'
|
|
}).then(function() {
|
|
window.location = 'index.php';
|
|
});
|
|
});
|
|
</script>";
|
|
} else {
|
|
echo "<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Gagal',
|
|
text: 'Terjadi kesalahan saat menghapus data',
|
|
confirmButtonText: 'OK'
|
|
}).then(function() {
|
|
window.location = 'index.php';
|
|
});
|
|
});
|
|
</script>";
|
|
}
|
|
?>
|