-
Notifications
You must be signed in to change notification settings - Fork 0
/
control.php
62 lines (46 loc) · 1.57 KB
/
control.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
<?php
require 'config.php';
function query($sql) {
global $con;
$result = mysqli_query($con, $sql);
$rows = [];
while ($row = mysqli_fetch_assoc($result)) {
$rows[] = $row;
}
return $rows;
}
function tambahAlternatif($data) {
global $con;
$nama = $data['nama'];
mysqli_query($con, "INSERT INTO alternatif VALUES (null, '$nama')");
return mysqli_affected_rows($con);
}
function tambahKriteria($data) {
global $con;
$nama = $data['nama'];
mysqli_query($con, "INSERT INTO kriteria VALUES (null, '$nama')");
return mysqli_affected_rows($con);
}
function tambahBobot($data) {
global $con;
$id_kriteria = $data['id'];
$value = $data['value'];
mysqli_query($con, "INSERT INTO bobot VALUES (null, '$id_kriteria', '$value')");
return mysqli_affected_rows($con);
}
function tambahSkala($data) {
global $con;
$nama = $data['nama'];
$value = $data['value'];
mysqli_query($con, "INSERT INTO skala VALUES (null, '$nama', '$value')");
return mysqli_affected_rows($con);
}
function tambahMatriks($data) {
global $con;
$alternatif = $data['alternatif'];
$bobot = $data['bobot'];
$skala = $data['skala'];
mysqli_query($con, "INSERT INTO matriks VALUES (null, '$alternatif', '$bobot', '$skala')");
return mysqli_affected_rows($con);
}
?>