-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
35 lines (30 loc) · 1.08 KB
/
index.php
File metadata and controls
35 lines (30 loc) · 1.08 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
<?php
require 'inc/pdo.php';
require 'inc/functions.php';
$query = $pdo -> prepare('SELECT COUNT(*) as count FROM city');
$query -> execute();
$count = $query -> fetchColumn();
$query = $pdo -> prepare('SELECT * FROM city ORDER BY Name ASC');
$query -> execute();
$cities = $query -> fetchAll();
$title='Accueil';
include 'inc/header.php';
?>
<div class="container">
<h1>Liste des villes</h1>
<p class="right">Total: <?=$count?> <a class="btn btn-green" href="/register.php">Ajouter une ville</a></p>
<div class="cities">
<?php
foreach ($cities as $city): ?>
<div class="city">
<h2><?=$city['Name']?></h2>
<div class="buttons">
<a class="btn" href="/edit.php?id=<?=$city['ID']?>">Modifier</a>
<a class="btn" href="/city.php?id=<?=$city['ID']?>">Voir plus</a>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php
include 'inc/footer.php';