-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
69 lines (65 loc) · 1.9 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
<?php
include("koneksi/koneksi.php");
// query untuk menampilkan data
$sql = 'SELECT * FROM data_barang';
$result = mysqli_query($conn, $sql);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/style1.css">
<title>Data Barang</title>
</head>
<body>
<div class="container">
<!-- navbar -->
<?php require('hed/header.php'); ?>
<!-- akhir navbar -->
<h1>Data Barang</h1>
<a href="crud/tambah.php" class="tambah">Tambah Barang</a>
<div class="main">
<table>
<tr>
<th>NO</th>
<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 $i = 1; ?>
<?php while ($row = mysqli_fetch_array($result)) : ?>
<tr>
<td><?= $i; ?></td>
<td><img src="crud/gambar/<?= $row['gambar']; ?>" alt="<?= $row['nama']; ?>" width="100">
</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="crud/ubah.php?id_barang=<?= $row['id_barang']; ?>" class="button">Ubah</a>
<a href="crud/hapus.php?id_barang=<?= $row['id_barang']; ?>" class="button1">Hapus</a>
</td>
</tr>
<?php $i++; ?>
<?php endwhile;
else : ?>
<tr>
<td colspan="7">Belum ada data</td>
</tr>
<?php endif; ?>
</table>
</div>
<?php require('hed/footer.php'); ?>
</div>
</body>
</html>