-
Notifications
You must be signed in to change notification settings - Fork 0
/
propertyList.php
83 lines (71 loc) · 1.92 KB
/
propertyList.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
//connect to database
require_once('database.php');
//get all units
$query = 'SELECT * FROM units
ORDER BY unitID';
$statement1 = $db->prepare($query);
$statement1->execute();
$units = $statement1->fetchAll();
$statement1->closeCursor();
?>
<!doctype html>
<html>
<head>
<title>Title</title>
<link rel="stylesheet" type="text/css" href="css/main.css"/>
</head>
<body>
<div class="wrapper">
<nav>
<?php include_once('navigation.php')?>
</nav>
<header>
<div class="hero">
</div>
</header>
<main>
<a href="addPropertyForm.php">Add new</a>
<table id="propertyList">
<tr>
<th> </th>
<th>Available</th>
<th>Advertised</th>
<th>Rent</th>
<th>SqFt</th>
<th>Beds</th>
<th>Baths</th>
<th> </th>
</tr>
<?php foreach ($units as $unit) : ?>
<tr>
<td class="address"><?php echo $unit['address'] ?></td>
<td class="middle"><?php
$date=date_create($unit['dateAvailable']);
echo date_format($date,"j M y");?>
</td>
<td class="middle"><?php echo $unit['advertised'] ?></td>
<td class="middle"><?php echo $unit['rentAmount'] ?></td>
<td class="middle"><?php echo $unit['squareFeet'] ?></td>
<td class="middle"><?php echo $unit['bedrooms'] ?></td>
<td class="middle"><?php echo $unit['bathrooms'] ?></td>
<td class="right"><form action="editPropertyForm.php" method="post">
<input type="hidden" name="unitID"
value="<?php echo $unit['unitID']; ?>">
<input type="submit" value="Edit">
</form></td>
<td><form action="deleteProperty.php" method="post">
<input type="hidden" name="unitID"
value="<?php echo $unit['unitID']; ?>">
<input type="submit" value="Delete">
</form></td>
</tr>
<?php endforeach; ?>
</table>
</main>
<footer>
<?php include_once('footer.php')?>
</footer>
</div>
</body>
</html>