-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·48 lines (37 loc) · 1.15 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
<?php require_once __DIR__ . '/layout/header.php';
require_once __DIR__ . '/db/pdo.php';
session_start();
if (isset($_SESSION['flash_message'])) { ?>
<div class="alert alert-success">
<?php echo $_SESSION['flash_message']; ?>
</div>
<?php
unset($_SESSION['flash_message']);
}
$stmt = $pdo->prepare(
"SELECT *, title, content, date_created FROM offers ORDER BY date_created DESC"
);
$results = $stmt->execute();
// var_dump($results);
// var_dump($_SESSION);
?>
<div class="container">
<h1 class="text-center my-5">Toutes nos offres</h1>
<div class="row">
<?php foreach ($stmt as $offer) {
?>
<div class="col-md-4 mb-3">
<div class="card">
<div class="card-body">
<h3> <?php echo $offer['title'] ?></h3>
<span class="badge bg-primary">
<?php echo $offer['date_created'] ?>
</span>
<p class="text-center text-muted mt-5 mb-0"><a href="/templates/offer_item.php?id=<?php echo $offer['id'] ?>" class="fw-bold text-body"><u>More details</u></a></p>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<?php require_once 'layout/footer.php';