forked from Kccorp/PA_2021_ESGI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShowTeam.php
77 lines (59 loc) · 1.96 KB
/
ShowTeam.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
<?php
include "header.php";
?>
<?php
if ($_SESSION["auth"] != true) {
?>
<div class="container">
<div class="row ">
<div class="col-12 text-center mt-5">
<h1><u><a class="text-black" href="login.php">Veuillez vous connecter pour consulter vos équipes !</a></u></h1>
</div>
</div>
</div>
<?php
}else{
?>
<div class="container">
<div class="row ">
<div class="col-12 text-center mt-5">
<h1><u>Choisissez une équipe !</u></h1>
<a href="newTeam.php">
<button type="button" class="btn mt-3 text-right btn-primary">Créer la vôtre !</button>
</a>
</div>
</div>
</div>
<table class="table table-striped text-center mt-4 mb-5" >
<thead>
<tr>
<th scope="col">Nom</th>
<th scope="col">Jeux</th>
<th scope="col">elo</th>
</tr>
</thead>
<tbody >
<?php
$connection = connectDB();
$queryPrepared = $connection->prepare("SELECT name, game, elo FROM ".PRE."Team INNER JOIN ".PRE."TeamUser ON ".PRE."Team.id_team = ".PRE."TeamUser.Team INNER JOIN ".PRE."User ON ".PRE."User.id_user = ".PRE."TeamUser.User WHERE id_user=:id;");
$queryPrepared->execute(["id"=>$_SESSION["info"]["id_user"]]);
$results = $queryPrepared->fetchALL(PDO::FETCH_ASSOC);
foreach ($results as $Teams => $infoTeam) {
echo "<tr>";
foreach ($infoTeam as $key => $value) {
if ($key=='name') {
$name = $value;
echo " <th scope='row' style='vertical-align: middle;' height='70em'> <a class='text-black' href='EditTeam2.php?name=".$name."'>".$value."</a></th> ";
}elseif ($key == 'game' || $key == 'elo') {
echo "<td style='vertical-align: middle;'> <a class='text-black' href='EditTeam2.php?name=".$name."'>".$value."</a></td>";
}
}
echo "</tr>";
}
?>
</tbody>
</table>
<?php
}
include "footer.php";
?>