-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
58 lines (53 loc) · 1.82 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
<html>
<head></head>
<body style="text-align: center">
<div id="main-content">
<h2 style="background:blue;color:white">All Records</h2>
<?php
$conn = mysqli_connect("localhost", "root", "", "product") or die("Connection Failed");
$sql = "SELECT * FROM product";
$result = mysqli_query($conn, $sql) or die("Query Unsuccessfull");
if(mysqli_num_rows($result) > 0) {
?>
<table style="margin:auto;background:white" cellpadding="7px">
<thead style="background:#33FF33">
<th>Id</th>
<th>Name</th>
<th>Description</th>
<th>Quantity</th>
<th>Price</th>
<th>Expire Date</th>
<th>Action</th>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_assoc($result)) {
?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['description']; ?></td>
<td><?php echo $row['quantity']; ?></td>
<td><?php echo $row['price']; ?></td>
<td><?php echo $row['expire_date']; ?></td>
<td>
<button style="background:#E7C011"><a href='edit.php?id=<?php echo $row['id']; ?>'>Edit</a></button>
<button style="background:#9B8F94 "><a href='delete.php?id=<?php echo $row['id']; ?>'><b>Delete</b></a></button>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php }
else echo "<h1>No Record Found</h1>";
mysqli_close($conn);
?>
<div style="text-align: center;padding-top: 5%">
<button style="background:#D133FF">
<a href='add.php'>ADD NEW RECORD</a>
</button>
</div>
</div>
</div>
</body>
</html>