forked from Nanra/Aplikasi-Hitung-Cepat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcariData.php
74 lines (67 loc) · 1.73 KB
/
cariData.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
66
67
68
69
70
71
72
73
74
<?php
global $link;
$input_cari = @$_POST['input_cari'];
$cari = @$_POST['cari'];
// jika tombol cari di klik
if($cari) {
// jika kotak pencarian tidak sama dengan kosong
if($input_cari != "") {
// query mysql untuk mencari berdasarkan nama negara. .
$sql = mysqli_query($link,"SELECT * FROM datamasuk WHERE kecamatan like '%$input_cari%' OR desa like '%$input_cari%'") or die (mysql_error());
} else {
$sql = mysqli_query($link,"SELECT * FROM datamasuk") or die (mysql_error());
}
} else {
$sql = mysqli_query($link,"SELECT * FROM datamasuk") or die (mysql_error());
}
// mengecek data
$cek = mysqli_num_rows($sql);
// jika data kurang dari 1
if($cek < 1) {
?>
<tr>
<!--muncul peringatan bahwa data tidak di temukan-->
<td colspan="7" align="center" style="padding:10px;">
<h4>Data Tidak Ditemukan</h4>
<script type='text/javascript'>
$(document).ready(function(){
$('.modal').modal({
dismissible: true,
opacity: .4,
in_duration: 400,
out_duration: 100,
});
$('#modal3').modal('open');
});
</script>
</td>
</tr>
<?php
} else {
// mengulangi data agar tidak hanya 1 yang tampil
while($data = mysqli_fetch_array($sql)) {
?>
<tr>
<td>
<?php echo $data['kecamatan'] ?>
</td>
<td>
<?php echo $data['desa'] ?>
</td>
<td align="center">
<?php echo $data['tps'] ?>
</td>
<td align="center">
<?php echo $data['paslon_satu'] ?>
</td>
<td align="center">
<?php echo $data['paslon_dua'] ?>
</td>
<td align="center">
<?php echo $data['paslon_tiga'] ?>
</td>
</tr>
<?php
}
}
?>