-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
44 lines (43 loc) · 1.57 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<title>Crud</title>
</head>
<body>
<h1>Crud</h1>
<a href="tambah.php" class="btn btn-primary" style="margin-bottom:10px">Tambah</a>
<table border="3px" width="1000px">
<tr align=center>
<th>No</th>
<th>Nama</th>
<th>Kelas</th>
<th>Alamat</th>
<th>Opsi</th>
</tr>
<?php
include "config.php";
$sql = "SELECT * FROM data";
$data = $conn->query($sql);
$no = 1;
while($dt = $data->fetch_array()) :
?>
<tr>
<td><?= $no++; ?></td>
<td><?= $dt['nama']; ?></td>
<td><?= $dt['kelas']; ?></td>
<td><?= $dt['alamat']; ?></td>
<td align="center">
<a onclick="return confirm('Yakin?')" href="hapus.php?id=<?= $dt['id']; ?>" class="btn btn-primary">Hapus</a>
<a href="edit.php?id=<?= $dt['id']; ?>" class="btn btn-primary">Edit</a>
</td>
</tr>
<?php endwhile; ?>
</table>
</body>
</html>