-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata-produk.php
119 lines (98 loc) · 4.81 KB
/
data-produk.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
session_start();
include 'db.php';
if($_SESSION['status_login'] != true){
echo '<script>window.location="login.php"</script>';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0" />
<title>Data Kategori</title>
<!-- CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
<link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection" />
</head>
<body>
<!--===== HEADER =====-->
<nav class="teal darken-2 lighten-1" role="navigation">
<div class="nav-wrapper container"><a id="logo-container" href="#" class="brand-logo">Dashboard</a>
<ul class="right hide-on-med-and-down">
<li><a href="dashboard.php">Dashboard</a></li>
<li><a href="profil.php">Profil</a></li>
<li><a href="data-kategori.php">Data Kategori</a></li>
<li><a href="data-produk.php">Data Produk</a></li>
<li><a href="keluar.php">Keluar</a></li>
</ul>
<ul id="nav-mobile" class="sidenav">
<li><a href="dashboard.php">Dashboard</a></li>
<li><a href="profil.php">Profil</a></li>
<li><a href="data-kategori.php">Data Kategori</a></li>
<li><a href="data-produk.php">Data Produk</a></li>
<li><a href="keluar.php">Keluar</a></li>
</ul>
<a href="#" data-target="nav-mobile" class="sidenav-trigger"><i class="material-icons">menu</i></a>
</div>
</nav>
<!--===== KONTEN =====-->
<div class="section">
<div class="container">
<h4>Data Produk</h4>
<div class="box">
<a class="waves-effect waves-light btn" href="tambah-produk.php">Tambah Data</a>
<table border="1" cellspacing="0" class="highlight">
<thead>
<tr>
<th width="60px" >No</th>
<th>Kategori</th>
<th>Nama Produk</th>
<th>Harga</th>
<th>Gambar</th>
<th>Status</th>
<th width="150px">Aksi</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
$produk = mysqli_query($conn, "SELECT * FROM tb_produk LEFT JOIN tb_kategori USING (kategori_id) ORDER BY produk_id DESC");
if(mysqli_num_rows($produk) > 0){
while($row = mysqli_fetch_array($produk)){
?>
<tr>
<td><?php echo $no++ ?></td>
<td><?php echo $row['kategori_nama'] ?></td>
<td><?php echo $row['produk_nama'] ?></td>
<td>Rp. <?php echo number_format($row['produk_harga']) ?></td>
<td> <a href="produk/<?php echo $row['produk_gbr'] ?> " target="_blank"> <img src="produk/<?php echo $row['produk_gbr'] ?>" width="50px"></a> </td>
<td><?php echo ($row['produk_status'] ==0 )?'Tidak Aktif': 'Aktif'; ?></td>
<td><a href="edit-produk.php?id=<?php echo $row['produk_id'] ?>">Edit</a> || <a href="proses-hapus.php?idp=<?php echo $row['produk_id'] ?>" onclick="return confirm ('Apakah Sudah Yakin Hapus')">Hapus</a></td>
</tr>
<?php }}else{ ?>
<tr>
<td colspan="8">Tidak Ada Data Produk</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
<!--===== FOOTER =====-->
<footer>
<div class="container">
<small>Copyright © 2022 <a class="teal-text text-darken-2 " href="https://www.himang.my.id/">Himang.my.id</a></small>
</div>
</footer>
<!-- Scripts-->
<script src="https://code.jquery.com/jquery-2.1.1.min.js "></script>
<script src="js/materialize.js "></script>
<script src="js/init.js "></script>
</body>
</html>