-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
52 lines (49 loc) · 1.03 KB
/
index.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
<html>
<head>
<title>Web Development Workshop</title>
<link href="simple-style.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
require_once('connect.php');
?>
<div id='header'>
<h1>Events</h1>
</div>
<div id='wrapper'>
<div id='sidebar'>
<ul id='links'>
<?php
$query='SELECT * FROM `events`';
if ($result = $mysqli->query($query))
{
/* fetch associative array */
while ($row = $result->fetch_assoc()) {
echo "<li><a href='index.php?eventid=".$row['id']."'>".$row['name']."</a></li>";
}
/* free result set */
$result->free();
}
?>
</ul>
</div>
<div id='main-content'>
<?php
$event_id = $_REQUEST['eventid'];
$query="SELECT * FROM `events` WHERE id='$event_id'";
if ($result = $mysqli->query($query))
{
if ($row = $result->fetch_assoc()) {
echo "<h2>$row[name]</h2>";
echo "<p>$row[details]</p>";
echo "<a class='reg' href='reg.php?eventid=$row[id]'>Register</a>";
}
$result->free();
}
/* close connection */
$mysqli->close();
?>
</div>
</div>
</body>
</html>