-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatedisplay.php
114 lines (95 loc) · 1.91 KB
/
datedisplay.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<html>
<head>
<style type="text/css">
h2{
color:green;
text-align: center;
}
.imgcontainer {
text-align: center;
margin: 24px 0 12px 0;
}
img.avatar {
width: 10%;
border-radius: 70%;
}
.container {
padding: 16px;
}
.submit{
background-color: #4CAF50;
width:25%;
margin-left: 450px;
}
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
border-spacing: 5px;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 15px;
border: 1px solid black;
border-collapse: collapse;
}
tr:nth-child(even) {
background-color: #dddddd;
}
</style>
</head>
<body> <h2>Date Calculation (Age in YYY : MM: DD: hh:mm:ss)</h2>
<div class="imgcontainer">
<img src="/phn.png" alt="Phone " class="avatar" ></div>
</body>
</html>
<?php
if(isset($_POST['search'])){
$db = pg_connect("host=localhost port=5432 dbname=phonebook user=postgres password=root");
/*if(!$db){
echo pg_last_error($db);
}else {
echo "hi";
}*/
$phone=$_POST["phonenumber"];
$sql =<<<EOF
select age(date) from phonedirectory where phone=$phone;
EOF;
$ret = pg_query($db, $sql);
if(!$ret){
echo pg_last_error($db);
exit;
}
echo "<caption><h3>AGE-CALCULATIONS</h3></caption>";
echo "<table>";
echo "<tr>";
echo "<th>AGE</th>";
echo "</tr>";
while($row = pg_fetch_row($ret)){
echo "<tr>";
echo "<td>".$row[0]."</td>";
echo "</tr>";
echo "</table>";
}
pg_close($db);
}
?>
<html>
<head>
<style type="text/css">
h3{
text-align: center;
color:blue;
}
</style>
</head>
<body>
</br></br>
<form action="datedisplay.php" >
<button style="width:15%;height:35px;margin-left:465px;color:white;background-color:black" class="btn" type="submit" name="home">Return Home</button>
</form> </br></br>
<hr>
<p6>This Website is Developed by <a href="https://www.facebook.com/rahulsinghranjann"><b>Rahul Ranjan</b></p6>
</body>
</html>