-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpastLocator.php
More file actions
49 lines (43 loc) · 1.54 KB
/
Copy pathpastLocator.php
File metadata and controls
49 lines (43 loc) · 1.54 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
<?php
include ('mpdf/mpdf.php');
$mpdf=new mPDF('','Letter', 0, '', 12, 12, 12, 12, 1, 1, '');
ob_start();
require_once 'config.php';
require_once 'dbopen.php';
if ($_POST[location]) $location = $_POST[location];
// get requestNumbers of selected blocks
$query = "select requestNumber, teacher_name, location, numberComputers
from reservation
where
location like ".$location." and (
requestNumber in(select block1 from reserved where day <= now() group by block1)
or requestNumber in(select block2 from reserved where day <= now() group by block2)
or requestNumber in(select block3 from reserved where day <= now() group by block4)
or requestNumber in(select block1 from reserved where day <= now() group by block4)
)";
if($debug) echo "Query is: ".$query."<br>";
$result= mysqli_query($mysqli, $query);
if(mysqli_num_rows($result) > 0) {
$table = "<h1>Computer requests in the past are as follows:</h1><div class='clean'>";
$table .= "<table><thead><tr>";
$table .= "<td>Reservation<br>Number</td><td>Teacher's<br>Name</td><td>Location</td><td>Number of<br>Computers</td>";
echo $table;
while ($row= mysqli_fetch_array($result,MYSQLI_NUM)) {
echo "<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td><td>";
}
} else {
echo "<h1>No computers were checked out in location ".$location.".</h1>";
}
echo "</table></div>";
require_once 'dbclose.php';
require_once 'end.php';
$html=ob_get_contents();
ob_end_clean();
if ($outputType == "pdf") {
$mpdf->WriteHTML($html);
$mpdf->Output();
} else {
echo $html;
}
exit;
?>