-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview_suplier.php
86 lines (78 loc) · 2.16 KB
/
view_suplier.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
<?php
require_once 'db.php';
session_start();
// Check if the user is logged in, redirect to login if not
// if (!isset($_SESSION['user_id'])) {
// header("Location: login.php");
// exit();
// }
// Fetch suppliers from the database
$sql = "SELECT * FROM suppliers";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "
<style>
table {
width: 100%;
border-collapse: collapse;
margin-top: 10px;
background-color: white;
}
th, td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #ddd
}
th {
background-color: #f2f2f2;
}
tr:hover {
background-color: #f5f5f5;
}
.table-container {
width: 80%;
margin: auto;
}
h2{
color: white;
font-size:30px;
}
</style>
<div class='table-container'>
<table> <h2>View Suppliers</h2>
<thead>
<tr>
<th>Supplier ID</th>
<th>Name</th>
<th>Email</th>
<th>Mobile No.</th>
<th>Address</th>
<th>Details</th>
<th>Remarks</th>
</tr>
</thead>
<tbody>
";
while ($row = $result->fetch_assoc()) {
echo "
<tr>
<td>" . htmlspecialchars($row['id']) . "</td>
<td>" . htmlspecialchars($row['name']) . "</td>
<td>" . htmlspecialchars($row['email']) . "</td>
<td>" . htmlspecialchars($row['mobile']) . "</td>
<td>" . htmlspecialchars($row['address']) . "</td>
<td>" . htmlspecialchars($row['details']) . "</td>
<td>" . htmlspecialchars($row['remarks']) . "</td>
</tr>
";
}
echo "
</tbody>
</table>
</div>
";
} else {
echo "<div style='text-align: center; margin-top: 20px;'>No suppliers found.</div>";
}
$conn->close();
?>