-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviewevent.php
More file actions
54 lines (54 loc) · 1.33 KB
/
Copy pathviewevent.php
File metadata and controls
54 lines (54 loc) · 1.33 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Table with database</title>
<?php
include 'header.php';
?>
<style>
table {
border-collapse: collapse;
width: 100%;
color: #588c7e;
font-family: monospace;
font-size: 25px;
text-align: left;
}
th {
background-color: #588c7e;
color: white;
}
tr:nth-child(even) {background-color: #f2f2f2}
</style>
</head>
<body>
<table>
<tr>
<th>Event Name</th>
<th>Description</th>
<th>Date</th>
<th>Time</th>
<th>Location</th>
<th>Organisation Name</th>
<th>Attendees</th>
</tr>
<?php
$conn = mysqli_connect("localhost", "root", "", "loginsystem");
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT event_id, event_name, event_location, event_date, event_time, event_description, orgname, attendees FROM events";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr><td>". $row["event_name"]. "<td>" . $row["event_description"]. "</td><td>" . $row["event_date"]. "</td><td>" . $row["event_time"]. "</td><td>" . $row["event_location"]. "</td><td>" . $row["orgname"] . "</td><td>" . $row["attendees"]. "</td></tr>";
}
echo "</table>";
} else { echo "0 results"; }
$conn->close();
?>
</table>
</body>
</html>