-
Notifications
You must be signed in to change notification settings - Fork 1
/
simpan.php
65 lines (53 loc) · 1.82 KB
/
simpan.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
64
65
<?php
//panggil koneksi database
include "koneksi.php";
//tampilkan data tikm
$tampil = mysqli_query($koneksi, "SELECT * from ikm limit 1");
$data = mysqli_fetch_array($tampil);
//tampung data ke dalam variabel
$id_ikm = $data['id_ikm'];
$puas = $data['puas'];
$cukup = $data['cukup'];
$kurang = $data['kurang'];
//ambil nilai keterangan
$keterangan = $_GET['ket'];
//uji jika keterangan tidak kosong
if(isset($keterangan)){
//uji jika keterangan = simpan
if($keterangan == "puas")
{
//nilai puas di tambah 1
$puas = $puas + 1;
//query update nilai puas dalam tabel tikm
$query = "UPDATE ikm SET puas= '$puas' where id_ikm = '$id_ikm' ";
mysqli_query($koneksi, $query);
echo "<script>alert('Terima kasih, anda berhasil memberikan penilaian.');document.location='index.php'</script>";
}
elseif($keterangan == "cukup")
{
//nilai cukup di tambah 1
$cukup = $cukup + 1;
//query update nilai cukup dalam tabel tikm
$query = "UPDATE ikm SET cukup= '$cukup' where id_ikm = '$id_ikm' ";
mysqli_query($koneksi, $query);
echo "<script>alert('Terima kasih, anda berhasil memberikan penilaian.');document.location='index.php'</script>";
}
elseif($keterangan == "kurang")
{
//nilai kurang di tambah 1
$kurang = $kurang + 1;
//query update nilai kurang dalam tabel tikm
$query = "UPDATE ikm SET kurang= '$kurang' where id_ikm = '$id_ikm' ";
mysqli_query($koneksi, $query);
echo "<script>alert('Terima kasih, anda berhasil memberikan penilaian.');document.location='index.php'</script>";
}
elseif($keterangan == "reset")
{
//reset
$query = "UPDATE ikm SET `puas` = '0', `cukup` = '0', `kurang` = '0' where id_ikm = '$id_ikm' ";
mysqli_query($koneksi, $query);
echo "<script>alert('Jumlah Suara Telah Di Reset!!');document.location='loginadmin/logout.php'</script>";
}
//update data sesuai query
}
?>