-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
66 lines (62 loc) · 2.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
include_once('template/head.php');
?>
<body>
<div class="row">
<div class="container">
<h2><i class="fa fa-users"></i> Aplikasi Data Mahasiswa</h2>
<hr>
<a href="input.php" class="btn btn-success"><i class="fa fa-plus"></i> Input Data</a>
<br><br>
<table class="table table-striped table-bordered table-hover" id="tb-mahasiswa">
<thead>
<tr>
<th>No</th>
<th>NIM</th>
<th>Nama</th>
<th>Jenis Kelamin</th>
<th>Semester</th>
<th>Prodi</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<?php
require_once('koneksi.php');
$no = 1;
$koneksiObj = new Koneksi();
$koneksi = $koneksiObj->getKoneksi();
if($koneksi->connect_error){
echo "Gagal Koneksi : ". $koneksi->connect_error;
echo "</td></tr>";
}
$query = "select * from data_mahasiswa";
$data = $koneksi->query($query);
if($data->num_rows <= 0){
echo "<tr>";
echo "<td colspan='7' class='text-center'><i>Tidak ada data</i></td>";
echo "</tr>";
} else{
while($row = $data->fetch_assoc()){
echo "<tr>";
echo "<td>".$no++."</td>";
echo "<td class='center'>".$row['nim']."</td>";
echo "<td>".$row['nama']."</td>";
echo "<td>".$row['jenis_kelamin']."</td>";
echo "<td class='center'>".$row['semester']."</td>";
echo "<td>".$row['prodi']."</td>";
echo '<td class="text-center"><a href="form-edit.php?nim='.$row['nim'].'" class="btn btn-info btn-xs"><i class="fa fa-pencil"></i></a>';
echo ' <a href="hapus.php?nim='.$row['nim'].'" class="btn btn-danger btn-xs"><i class="fa fa-trash"></i></a></td>';
echo "</tr>";
}
}
?>
</tbody>
</table>
</div>
</div>
</body>
<?php
include_once('template/script.php');
?>
</html>