-
Notifications
You must be signed in to change notification settings - Fork 0
/
emp_query.php
81 lines (76 loc) · 2.59 KB
/
emp_query.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
<?php
require 'vendor/autoload.php';
/*To display the data from the collection*/
$mclient = new MongoDB\Client;
$msdb = $mclient->company;
$empcollection = $msdb->emp;
$list = $empcollection->find();
echo "<html> <style>
body
{
background-image: url('cmp.jpg');
background-position: center;
background-repeat: no-repeat;
}
h2
{
color:yellow;
}
</style> <hr><h2 align='center'>Existing Employee Records</h2><hr> </html>";
$emp_details = "<table style='border:1px solid red; margin-left:200px; margin-top:80px; align='center'";
$emp_details .= "border-collapse:collapse' border='1px'>";
$emp_details .= "<thead>";
$emp_details .= "<tr>";
$emp_details .= "<th bgcolor='orange'>EID</th>";
$emp_details .= "<th bgcolor='orange'>NAME</th>";
$emp_details .= "<th bgcolor='orange'>DOB</th>";
$emp_details .= "<th bgcolor='orange'>DOJ</th>";
$emp_details .= "<th bgcolor='orange'>DESIGNATION</th>";
$emp_details .= "<th bgcolor='orange'>SALARY</th>";
$emp_details .= "<th bgcolor='orange'>CONTACT NO.</th>";
$emp_details .= "<th bgcolor='orange'>ADDRESS</th>";
$emp_details .= "</tr>";
$emp_details .= "</thead>";
$emp_details .= "<tbody>";
foreach ($list as $item)
{
$emp_details .= "<tr>";
$emp_details .= "<td bgcolor='orange'>" . $item["_id"] . "</td>";
$emp_details .= "<td bgcolor='orange'>" . $item["name"]."</td>";
$emp_details .= "<td bgcolor='orange'>" . $item["dob"]."</td>";
$emp_details .= "<td bgcolor='orange'>" . $item["doj"]."</td>";
$emp_details .= "<td bgcolor='orange'>" . $item["designation"]."</td>";
$emp_details .= "<td bgcolor='orange'>" . $item["salary"]."</td>";
$emp_details .= "<td bgcolor='orange'>" . $item["contact"]."</td>";
$emp_details .= "<td bgcolor='orange'>" . $item["address"]."</td>";
$emp_details .= "</tr>";
}
$emp_details .= "</tbody>";
$emp_details .= "</table>";
echo $emp_details;
?>
<!DOCTYPE html>
<html>
<body>
<style type="text/css">
.button {
background-color: #4CAF50;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
</style>
<br><br><br><br><br>
<center>
<form action="index.php">
<button type="submit" class="button" value="submit">Back!</button>
</form>
</center>
</body>
</html>