-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost-pmb.php
56 lines (36 loc) · 1.64 KB
/
post-pmb.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
<?php
require ('config/Database.php');
require ('helpers/PreventInjectionSQL.php');
session_start();
if(!isset($_SESSION['username'])) {
header('Location:index.php');
}
$connect = openConnection();
// jumlah pengunjung
$tahun = preventInjection($_POST['tahun']);
// pengunjung yang berbelanja
$jumlah = preventInjection($_POST['jumlah']);
if($runquery1 = mysqli_query($connect,"insert into pmb (tahun_penerimaan, jumlah_pendaftar) values ('$tahun', '$jumlah')")) {
header('Location:create-pmb.php');
} else {
header("Location:create-pmb.php?notify=error");
}
// $check = mysqli_query($connect,"select * from pmb_fakultas where tahun_penerimaan ='$tahun' and fakultas ='$fakultas'");
// if(mysqli_num_rows($check) > 0) {
// header("Location:create-pmb.php?notify=error");
// } else {
// mysqli_query($connect,"insert into pmb_fakultas (tahun_penerimaan,fakultas,jumlah_pendaftar) values('$tahun','$fakultas','$jumlah')");
// $checkTahun = mysqli_query($connect,"select * from pmb where tahun_penerimaan='$tahun'");
// if(mysqli_num_rows($checkTahun) == 1){
// $jumlaha = mysqli_query($connect,"select jumlah_pendaftar from pmb where tahun_penerimaan ='$tahun'");
// while($jumlah0 = mysqli_fetch_object($jumlaha)){
// $jumlah_asli = $jumlah0->jumlah_pendaftar;
// }
// $rawJumlah = $jumlah + $jumlah_asli;
// mysqli_query($connect,"update pmb set jumlah_pendaftar='$rawJumlah' where tahun_penerimaan='$tahun'");
// // print_r($rawJumlah);
// } else {
// mysqli_query($connect,"insert into pmb (tahun_penerimaan,jumlah_pendaftar) values ('$tahun','$jumlah')");
// }
// header('Location:create-pmb.php');
// }