-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcarnet.php
70 lines (54 loc) · 1.75 KB
/
carnet.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
<?php
session_start();
include('inc/pdo.php');
include('inc/function.php');
if(!isLogged()){
header('Location: connexion.php');
}
$title = 'Mon Carnet';
$id = $_SESSION['user']['id'];
// affcihe le carnet pour pouvoir séléctioner l'id du vaccin
$sql = "SELECT * FROM user_vaccin WHERE user_id = :id";
$var = $pdo->prepare($sql);
$var->bindValue(':id',$id,PDO::PARAM_INT);
$var->execute();
$vaccins_user = $var->fetchall();
// debug($vaccins_user);
include('inc/header.php'); ?>
<h1>Mon Carnet de Vaccination</h1>
<div class="carnet">
<table id="customers">
<tr>
<th>Mes Vaccins</th>
<th>Fait le</th>
<th>Numéro de lot</th>
<th>Rappel</th>
</tr>
<?php foreach ($vaccins_user as $vaccin_user) {
$idvac = $vaccin_user['vaccin_id'];
// choisis l'id du vaccin pour ensuite afficher son nom
$sql = "SELECT * FROM vac_vaccins WHERE id = :idvac";
$var = $pdo->prepare($sql);
$var->bindValue(':idvac',$idvac,PDO::PARAM_INT);
$var->execute();
$vaccins = $var->fetchAll();
// debug($vaccins); ?>
<tr>
<?php foreach ($vaccins as $vaccin) { ?>
<td><?php echo $vaccin['name']; ?></td>
<td><?php echo formatageDate2($vaccin_user['fait_at']); ?></td>
<td><?php echo $vaccin_user['numero_lot']; ?></td>
<td><?php echo $vaccin_user['rappel']; ?></td>
<?php } ?>
</tr>
<?php }?>
<tr>
<th><a href="addvaccin.php">Ajouter un vaccin</a></th>
<th></th>
<th></th>
<th></th>
</tr>
</table>
</div>
<?php
include('inc/footer.php');