forked from Bunkermaster/crud-webp2020-g1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
54 lines (54 loc) · 1.19 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
49
50
51
52
53
54
<?php
require_once "connexion.php";
$requete = "SELECT
`id`,
`nom`,
`marque`
FROM
`garage`
;";
$stmt = $conn->prepare($requete);
$stmt->execute();
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Liste des garages</title>
<style>
td, th {
border-bottom: 1px solid #128f27;
}
</style>
</head>
<body>
<?php
if (isset($_GET['error'])) {
?>
<div style="color: red"><?=$_GET['error']?></div>
<?php
}
?>
<h1>Garage ¬_¬</h1>
<a href="add.php">Ajouter</a>
<table cellspacing="0" cellpadding="0" width="100%">
<tr>
<th>id</th>
<th>Nom</th>
<th>Marque</th>
<th>Action</th>
</tr>
<?php while(false !== $row = $stmt->fetch(PDO::FETCH_ASSOC)):?>
<tr>
<td><?=$row['id']?></td>
<td><a href="details.php?id=<?=$row['id']?>"><?=$row['nom']?></a></td>
<td><?=$row['marque']?></td>
<td>
<a href="delete.php?id=<?=$row['id']?>">Supprimer</a>
<a href="edit.php?id=<?=$row['id']?>">Modifier</a>
</td>
</tr>
<?php endwhile;?>
</table>
</body>
</html>