-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviewsheet.php
More file actions
56 lines (56 loc) · 1.55 KB
/
Copy pathviewsheet.php
File metadata and controls
56 lines (56 loc) · 1.55 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
55
56
<?php
require "includes/header.php";
$userid = $_SESSION['userid'];
// CONNECT TO DATABASE
include 'includes/library.php';
$pdo = connectdb();
// QUERY FOR TITLE
$sheetid = $_GET['sheetid'];
$query = "SELECT * FROM signin_info where sheetid = ? and userid = ?";
$stmt=$pdo->prepare($query);
$results = $stmt->execute(array($sheetid,$userid));
$t1row = $stmt->fetch();
// QUERY FOR DESCRIPTION
$query = "SELECT * FROM slot_info where sheetid = ?";
$stmt=$pdo->prepare($query);
$results = $stmt->execute([$sheetid]);
$t2row = $stmt->fetch();
// QUERY FOR USERS
$query = "SELECT * FROM slot_info WHERE sheetid = ?";
$stmt=$pdo->prepare($query);
$results = $stmt->execute([$sheetid]);
if (!$stmt) { die("Something went horribly wrong"); }
$table = $stmt->fetchAll();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php $page_title = "View Sign up sheet"; ?>
<?php include "includes/metadata.php" ?>
</head>
<body>
<section class = "vsheet">
<h2><?php echo $t1row['title'] ?></h2>
<p><?php echo $t1row['description'] ?></p>
<table>
<thead>
<tr>
<th>Title</th>
<th>Timeslot</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<?php foreach($table as $r): ?>
<tr>
<td><?php echo "$r[title]"; ?></td>
<td><?php echo "$r[timeslot]"; ?></td>
<td><?php echo "$r[user]"; ?></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</section>
<?php include "includes/footer.php" ?>
</body>
</html>