forked from alfiansx/php_crud_mahasiswa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
96 lines (75 loc) · 2.67 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
session_start();
require_once 'function/functions.php';
$data['title'] = 'Halaman Utama';
$rows = query("SELECT * FROM mahasiswa ORDER BY id DESC");
// memanggil file header.php
view('templates/header', $data);
?>
<div class="container mt-3 mb-3">
<div class="row">
<div class="col-md-8">
<div class="flash-container">
<!-- tempat pemberitahuan -->
<?= flashdata(); ?>
</div>
<!-- tombol tambah data -->
<a href="insert.php" class="btn btn-primary text-light mb-3">
<small class="fas fa-fw fa-plus mr-1"></small>
<small>tambah data</small>
</a>
</div>
</div>
<div class="row">
<div class="col">
<!-- table -->
<div class="table-responsive">
<table class="table table-striped table-bordered" id="myTable">
<thead>
<tr>
<th>#</th>
<th>Nama</th>
<th>Nrp</th>
<th>Email</th>
<th>Jurusan</th>
<th>Opsi</th>
</tr>
</thead>
<tbody>
<?php $no = 1; ?>
<?php foreach ($rows as $row) : ?>
<tr>
<td><small class="text-black-50"><?= $no++; ?></small></td>
<td><small class="text-black-50"><?= strtolower($row['nama']); ?></small></td>
<td><small class="text-black-50"><?= strtolower($row['nrp']); ?></small></td>
<td><small class="text-black-50"><?= strtolower($row['email']); ?></small></td>
<td><small class="text-black-50"><?= strtolower($row['jurusan']); ?></small></td>
<td>
<div class="d-flex justify-content-center">
<a href="detail.php?id=<?= $row['id']; ?>" class="badge badge-primary p-2 text-light mr-1">
<small class="fas fa-fw fa-eye mr-1"></small>
<small>detail</small>
</a>
<a href="edit.php?id=<?= $row['id']; ?>" class="badge badge-success p-2 text-light mr-1">
<small class="fas fa-fw fa-edit mr-1"></small>
<small>ubah</small>
</a>
<a href="" class="badge badge-danger p-2 text-light badge-deletes" data-target="delete.php?id=<?= $row['id']; ?>">
<small class="fas fa-fw fa-trash alt mr-1"></small>
<small>hapus</small>
</a>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php
$data['javascript'] = 'script.js';
// memanggil file footer.php
view('templates/footer', $data);
?>