-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
61 lines (58 loc) · 1.68 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
include('koneksi.php');
?>
<!DOCTYPE html>
<html>
<head>
<title>Absensi Sekolah</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<center><h1>Data Siswa</h1><center>
<center><a href="create.php">+ Tambah Data</a><center>
<br/>
<table>
<thead>
<tr>
<th>No</th>
<th>Nama</th>
<th>Nis</th>
<th>Kelas</th>
<th>Keterangan</th>
<th>Gambar</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
// jalankan query untuk menampilkan semua data diurutkan berdasarkan nim
$query = "SELECT * FROM $tb ORDER BY id ASC";
$result = mysqli_query($koneksi, $query);
if(!$result){
die ("Query Error: ".mysqli_errno($koneksi).
" - ".mysqli_error($koneksi));
}
$no = 1;
while($row = mysqli_fetch_assoc($result))
{
?>
<tr>
<td><?php echo $no; ?></td>
<td><?php echo $row['nama']; ?></td>
<td><?php echo $row['nis']; ?></td>
<td><?php echo $row['kelas']; ?></td>
<td><?php echo $row['ket']; ?></td>
<td style="text-align: center;"><img src="gambar/<?php echo $row['gambar_produk']; ?>" style="width: 120px;"></td>
<td>
<a href="update.php?id=<?php echo $row['id']; ?>">Edit</a> |
<a href="delete.php?id=<?php echo $row['id']; ?>" onclick="return confirm('Anda yakin akan menghapus data ini?')">Hapus</a>
</td>
</tr>
<?php
$no++;
}
?>
</tbody>
</table>
</body>
</html>