This repository has been archived by the owner on Sep 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hapus-kriteria.php
63 lines (47 loc) · 1.58 KB
/
hapus-kriteria.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php require_once('includes/init.php'); ?>
<?php
$ada_error = false;
$result = '';
$id_kriteria = (isset($_GET['id'])) ? trim($_GET['id']) : '';
if(!$id_kriteria) {
$ada_error = 'Maaf, data tidak dapat diproses.';
} else {
$query = $pdo->prepare('SELECT id_kriteria FROM kriteria WHERE kriteria.id_kriteria = :id_kriteria');
$query->execute(array('id_kriteria' => $id_kriteria));
$result = $query->fetch();
if(empty($result)) {
$ada_error = 'Maaf, data tidak dapat diproses.';
} else {
$handle = $pdo->prepare('DELETE FROM nilai_kenshin WHERE id_kriteria = :id_kriteria');
$handle->execute(array(
'id_kriteria' => $result['id_kriteria']
));
$handle = $pdo->prepare('DELETE FROM pilihan_kriteria WHERE id_kriteria = :id_kriteria');
$handle->execute(array(
'id_kriteria' => $result['id_kriteria']
));
$handle = $pdo->prepare('DELETE FROM kriteria WHERE id_kriteria = :id_kriteria');
$asem = $handle->execute(array(
'id_kriteria' => $result['id_kriteria']
));
redirect_to('list-kriteria.php?status=sukses-hapus&kyu='.$_GET['kyu']);
}
}
?>
<?php
$judul_page = 'Hapus Kriteria';
require_once('template-parts/header.php');
?>
<div class="main-content-row">
<div class="container clearfix">
<?php include_once('template-parts/sidebar-kriteria.php'); ?>
<div class="main-content the-content">
<h1><?php echo $judul_page; ?></h1>
<?php if($ada_error): ?>
<?php echo '<p>'.$ada_error.'</p>'; ?>
<?php endif; ?>
</div>
</div><!-- .container -->
</div><!-- .main-content-row -->
<?php
require_once('template-parts/footer.php');