-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewBusinesses.php
executable file
·69 lines (63 loc) · 2.39 KB
/
viewBusinesses.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
<?php
require_once 'Connection.php';
require_once 'BusinessTableGateway.php';
require 'ensureUserLoggedIn.php';
$connection = Connection::getInstance();
$gateway = new BusinessTableGateway($connection);
$statement = $gateway->getBusinesses();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="js/business.js"></script>
<?php require "styles.php" ?>
<title></title>
</head>
<body>
<?php require 'toolbar.php' ?>
<?php require 'header.php' ?>
<?php require 'mainMenu.php' ?>
<div class="container">
<h2>View Businesses</h2>
<?php
if (isset($message)) {
echo '<p>' . $message . '</p>';
}
?>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Mobile</th>
<th>Staff Number</th>
<th>Skills</th>
</tr>
</thead>
<tbody>
<?php
$row = $statement->fetch(PDO::FETCH_ASSOC);
while ($row) {
echo '<td>' . $row['business_name'] . '</td>';
echo '<td>' . $row['business_address'] . '</td>';
echo '<td>' . $row['business_lat'] . '</td>';
echo '<td>' . $row['business_long'] . '</td>';
echo '<td>' . $row['business_type'] . '</td>';
echo '<td>'
. '<a href="viewBusiness.php?id=' . $row['id'] . '">View</a> '
. '<a href="editBusinessForm.php?id=' . $row['id'] . '">Edit</a> '
. '<a class="deleteBusiness" href="deleteBusiness.php?id=' . $row['id'] . '">Delete</a> '
. '</td>';
echo '</tr>';
$row = $statement->fetch(PDO::FETCH_ASSOC);
}
?>
</tbody>
</table>
<p><a href="createBusinessForm.php">Create Business</a></p>
</div>
<?php require 'footer.php'; ?>
<?php require 'scripts.php'; ?>
</body>
</html>