-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlistManagers.php
executable file
·73 lines (54 loc) · 1.54 KB
/
listManagers.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
<!DOCTYPE html>
<?php
$currentpage="List Managers";
?>
<html>
<head>
<title>List Managers</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<?php
// change the value of $dbuser and $dbpass to your username and password
include 'connectvars.php';
include 'header.php';
$conn = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if (!$conn) {
die('Could not connect: ' . mysql_error());
}
// query to select all information from supplier table
$query = "SELECT * FROM `Manager` ";
// Get results from query
$result = mysqli_query($conn, $query);
if (!$result) {
die("Query to show fields from table failed");
}
if(mysqli_num_rows($result) > 0){
echo "<h1>Managers</h1>";
echo "<table id='t01' border='1'>";
echo "<thead>";
echo "<tr>";
echo "<th>managerID</th>";
echo "<th>Name</th>";
echo "<th>Email</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
while($row = mysqli_fetch_array($result)){
echo "<tr>";
echo "<td>" . $row['managerID'] . "</td>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['Email'] . "</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
// Free result set
mysqli_free_result($result);
} else{
echo "<p class='lead'><em>No records were found.</em></p>";
}
mysqli_close($conn);
?>
</body>
</html>