-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
62 lines (59 loc) · 1.95 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
<?php include("koneksi.php");
$sql = 'SELECT * FROM data_barang';
$result = mysqli_query($conn, $sql);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="style.css" rel="stylesheet" type="text/css" />
<title>Data Barang</title>
<style>
.link {
display: inline-block;
margin: 20px 0px;
}
a {
margin: 0px 15px;
}
</style>
</head>
<body>
<div class="container">
<h1>Data Barang</h1>
<a class="link" href="tambah.php"> Tambah Barang</a>
<div class="main">
<table border="1" cellpadding="4" cellspacing="0">
<tr>
<th>Gambar</th>
<th>Nama Barang</th>
<th>Katagori</th>
<th>Harga Beli</th>
<th>Harga Jual</th>
<th>Stok</th>
<th>Aksi</th>
</tr>
<?php if($result): ?>
<?php while($row = mysqli_fetch_array($result)): ?>
<tr>
<td><img src="gambar/<?= $row['gambar'];?>" alt="<?= $row['nama'];?>"></td>
<td><?= $row['nama'];?></td>
<td><?= $row['kategori'];?></td>
<td><?= $row['harga_beli'];?></td>
<td><?= $row['harga_jual'];?></td>
<td><?= $row['stok'];?></td>
<td><a href="ubah.php?halaman=ubahproduk&id=<?php echo $row['id_barang']
; ?>"> Ubah</a>
<a onclick="return confirm('Anda Yakin Ingin Menghapus Data Ini?')" href="hapus.php?halaman=hapusproduk&id=<?php echo $row['id_barang']
; ?>" >Hapus</a></td>
</tr>
<?php endwhile; else: ?>
<tr>
<td colspan="7">Belum ada data</td>
</tr>
<?php endif; ?>
</table>
</div>
</div>
</body>
</html>