-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
69 lines (51 loc) · 1.81 KB
/
Copy pathadmin.php
File metadata and controls
69 lines (51 loc) · 1.81 KB
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
<?php
require 'core/init.php';
require 'view/header.php';
// jika blm login
if (!isset($_SESSION["login"])) {
echo "<script>
alert('Anda Belum Login, Silahkan Login !');
document.location.href='login.php';
</script>";
}
// ambil data dri table
$products = query("SELECT * FROM products");
if ( !$products ) {
echo mysqli_error($db);
exit;
}
?>
<div class="container">
<h2 class="text-center wr-title py-3">Selamat Datang di Halaman Admin !</h2>
<table class="table table-bordered">
<thead class="clr-chart">
<tr class="text-white">
<th>No</th>
<th>Nama</th>
<th>Harga</th>
<th>Deskripsi</th>
<th>Foto</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<?php $nomor = 1; ?>
<?php foreach( $products as $product ) : ?>
<tr>
<td><?= $nomor ?></td>
<td><?= $product["nama_products"]; ?></td>
<td>Rp. <?= $product["harga_products"]; ?></td>
<td><?= $product["deskripsi_products"]; ?></td>
<td><img src="view/images/<?= $product["foto_products"]; ?>" alt="gambar-products" width="50"></td>
<td>
<a href="ubah.php?id_products=<?= $product["id_products"]; ?>" class="btn btn-warning">Ubah</a>
<a href="functions/hapus.php?id_products=<?= $product["id_products"]; ?>" class="btn btn-danger" onclick="return confirm('Yakin ?');">Hapus</a>
</td>
</tr>
<?php $nomor++; ?>
<?php endforeach; ?>
</tbody>
</table>
<a href="tambah_product.php" class="btn btn-success my-2">Tambah Product</a>
</div>
<?php require 'view/footer.php'; ?>