-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevtable.php
78 lines (69 loc) · 1.47 KB
/
evtable.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
<!DOCTYPE html>
<html>
<head>
<title>Table with database</title>
<style>
table {
border-collapse: collapse;
width: 100%;
color: #588c7e;
font-family: monospace;
font-size: 25px;
text-align: left;
}
.head {
background-color: #192435;
color: white;
}
.headtop
{
background-color: lightseagreen;
color: #192435;
text-align: center;
}
tr:nth-child(even) {background-color: #f2f2f2}
</style>
</head>
<body>
<table>
<tr>
<th class="headtop" colspan="7 " ><h4>Your University Events List </h4></th>
</tr>
<tr>
<th class="head">Event ID</th>
<th class="head">Event Name</th>
<th class="head">Start</th>
<th class="head">End</th>
<th class="head">Link</th>
<th class="head">Description</th>
</tr>
<?php
$conn = mysqli_connect("localhost", "root", "", "events");
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT eid, ename, sdate, edate, link, Description FROM eventslist";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo
"<tr>
<td>" . $row["eid"]. "</td>
<td>" . $row["ename"] . "</td>
<td>". $row["sdate"]. "</td>
<td>". $row["edate"]. "</td>
<td> <a href=". $row["link"].">Link</a> </td>
<td>". $row["Description"]. "</td>
</tr>";
// echo "<tr><td>" . $row["eid"]. "</td><td>" . $row["ename"] . "</td><td>"
// . $row["edate"]. "</td></tr>";
}
echo "</table>";
} else { echo "0 results"; }
$conn->close();
?>
</table>
</body>
</html>