-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
40 lines (38 loc) · 1.16 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
<?php
include 'koneksi.php';
$result = mysqli_query($koneksi, "SELECT * FROM siswa");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contoh CRUD</title>
</head>
<body>
<h2>Data Siswa</h2>
<table border="1">
<tr>
<th>Nama</th>
<th>Jenis Kelamin</th>
<th>Kelas</th>
<th>Hobi</th>
<th>Aksi</th>
</tr>
<?php while ($row = mysqli_fetch_assoc($result)) : ?>
<tr>
<td><?= $row['nama']; ?></td>
<td><?= $row['jenis_kelamin']; ?></td>
<td><?= $row['kelas']; ?></td>
<td><?= $row['hobi']; ?></td>
<td>
<a href="edit.php?id=<?= $row['id']; ?>">Edit</a>
<a href="delete.php?id=<?= $row['id']; ?>" onclick="return confirm('Apakah Anda yakin ingin menghapus data ini?')">Hapus</a>
</td>
</tr>
<?php endwhile; ?>
</table>
<br>
<a href="tambah.php">Tambah Data</a>
</body>
</html>