<!DOCTYPE html>
<html>
<head>
<title>Tampil Data Siswa</title>
<!--Link Untuk Mempelajari Bootstraps: https://getbootstrap.com/docs/4.1/getting-started/introduction/ dan setelah membuka link ini antum harus cari cari biar ketemu...-->
<!--Bootstraps-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
</head>
<body>
<div class="container">
<!--table-responsive, table-responsive-sm-->
<!--Conntoh Lain Button di bawah ini-->
<!--<a class="btn btn-primary fixed-bottom" href="insertsiswa.php">Tambah Data</a>-->
<br>
<a class="btn btn-primary" href="insertsiswa.php">Tambah Data</a>
<br>
<br>
<table class="table table-striped" border="1">
<caption>Hak Cipta © Azhar</caption>
<!--table-bordered, table-hover, table-sm-->
<?php
include 'koneksi.php';
$sql = "SELECT * FROM tb_siswa";
$tampil_data = $koneksi->query($sql);
if ($tampil_data->num_rows > 0) {
?>
<thead class="thead-dark">
<!--thead-light, thead-->
<tr>
<th>No</th>
<th>Nama</th>
<th>Alamat</th>
<th>Kelas</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
while ($row = $tampil_data->fetch_assoc()) {
?>
<tr>
<td><?= $no++ ?></td>
<td><?= $row['nama_siswa']?></td>
<td><?= $row['alamat_siswa']?></td>
<td><?= $row['id_kelas']?></td>
<td><a class="btn btn-warning" href="editsiswa.php?id=<?= $row['id_siswa'] ?>">Edit</a> <a class="btn btn-danger" href="hapussiswa.php?id=<?= $row['id_siswa']?>" onclick="return confirm('Hapus Data ?')">Hapus</a></td>
</tr>
<?php }
} else {
echo "Data Kosong";
}
?>
</tbody>
</table>
</div>
<!--JQuery-->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<!--JQuery-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<!--Bootstrap-->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
</body>
</html>