-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
65 lines (61 loc) · 2.21 KB
/
Copy pathindex.php
File metadata and controls
65 lines (61 loc) · 2.21 KB
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
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Membuat Live Search PHP Ajax - Sekolah Program</title>
<link rel="stylesheet" href="bootstrap.min.css">
</head>
<body>
<div class="container">
<input type="text" id="search" class="form-control mt-3 mb-5" placeholder="serach name...">
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>#</th>
<th>name</th>
<th>username</th>
<th>password</th>
</tr>
</thead>
<tbody id="tampil">
<?php
require_once 'connect.php';
$no = 1;
$query = mysqli_query($conn, "SELECT * FROM users");
while ($row = mysqli_fetch_object($query)) {
?>
<tr>
<td><?= $no++; ?></td>
<td><?= $row->name; ?></td>
<td><?= $row->username; ?></td>
<td><?= $row->password; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<a href="https://sekolahprogram.com" class="btn btn-success mt-3 btn-block" target="_blank" rel="noopener noreferrer">By Sekolah Program</a>
</div>
<script src="jquery.min.js" charset="utf-8"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#search').on('keyup', function() {
$.ajax({
type: 'POST',
url: 'search.php',
data: {
search: $(this).val()
},
cache: false,
success: function(data) {
$('#tampil').html(data);
}
});
});
});
</script>
</body>
</html>