Code html : Sélectionner tout - Visualiser dans une fenêtre à part
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137 <!DOCTYPE html> <html lang="fr"> <head> <meta charset="utf-8"> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="css/bootstrap.css"> <link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="css/carousel.css"> <title>Coupe du monde de rugby 2011</title> <script src="js/jquery.js"></script> <script src="js/bootstrap.min.js"></script> </head> <?php try{ $bdd=new PDO('mysql:host=localhost;dbname=rugby2011;charset=utf8', 'root',''); $bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); }catch(Exception $e){ die('Erreur :' . $e->getMessage()); } $response = $bdd->query('SELECT * FROM scorematch '); $scorematch = $response->fetchAll(); ?> <body> <h1>Coupe du monde de rugby 2011</h1> <div id="matchpoule"> <div class="container"> <div class="row"> <div class="col-sm-12"> <?php if (!empty($scorematch)){ $response = $bdd->query('SELECT * FROM scorematch'); $scorematch = $response->fetchAll(); ?> <table> <tr> <th>Pays</th> <th>Groupe</th> <th>Bonus</th> <th>Score</th> <th>Score</th> <th>Bonus</th> <th>Groupe</th> <th>Pays</th> </tr> <?php foreach($scorematch as $score){ echo '<tr><td>'.htmlspecialchars($score['equipe']).'</td><td>'.htmlspecialchars($score['groupe']).'</td><td>'.htmlspecialchars($score['bonus']).'</td><td>'.htmlspecialchars($score['score']).'</td><td>'.htmlspecialchars($score['score2']).'</td><td>'.htmlspecialchars($score['bonus2']).'</td><td>'.htmlspecialchars($score['groupe2']).'</td><td>'.htmlspecialchars($score['equipe2']).'</td></tr>'; } ?> </table> <?php } ?> </div> </div> </div> </div> <div id="classementpoule"> <div class="container"> <div class="row"> <div class="col-sm-12"> <a href="includes/scoreequipe.php">Points par équipe</a> <h4 align="center">Poule A</h4> <table> <?php $response = $bdd->query("SELECT * FROM pointsequipe WHERE equipe ='Nouvelle Zélande'"); $pointsequipe = $response->fetchAll(); $response1=$bdd->query("SELECT SUM(bonus) AS totalbonus FROM pointsequipe"); $bonus=$response1->fetch(); $bonus=$totalbonus['totalbonus']; $response1=$bdd->query("SELECT SUM(pour) AS totalpour FROM pointsequipe"); $pour=$response1->fetch(); $pour=$totalpour['totalpour']; $response1=$bdd->query("SELECT SUM(contre) AS totalcontre FROM pointsequipe"); $contre=$response1->fetch(); $contre=$totalcontre['totalcontre']; $response1=$bdd->query("SELECT $totalpour-$totalcontre AS differences FROM pointsequipe"); $differences=$response1->fetch(); $differences=$difference['difference']; ?> <tr> <th>Equipe</th> <th>Points</th> <th>Buts pour</th> <th>Buts contre</th> <th>Différence</th> </tr> <?php if (!empty($pointsequipe)){ echo '<tr><td>'.htmlspecialchars($data['equipe']).'</td><td>'.htmlspecialchars($totalbonus['totalbonus']).'</td><td>'.htmlspecialchars($totalpour['totalpour']).'</td><td>'.htmlspecialchars($totalcontre['totalcontre']).'</td><td>'.htmlspecialchars($difference['difference']).'</td></tr>'; } ?> </table> <h4 align="center">Poule B</h4> <table> <tr> <th>Equipe</th> <th>Points</th> <th>Buts pour</th> <th>Buts contre</th> <th>Différence</th> </tr> </table> <h4 align="center">Poule C</h4> <table> <tr> <th>Equipe</th> <th>Points</th> <th>Buts pour</th> <th>Buts contre</th> <th>Différence</th> </tr> </table> <h4 align="center">Poule D</h4> <table> <tr> <th>Equipe</th> <th>Points</th> <th>Buts pour</th> <th>Buts contre</th> <th>Différence</th> </tr> </table> </div> </div> </div> </div> <script type="application/javascript" src="js/jquery-3.1.1.min.js"></script> <script src="js/script.js"></script> </body> </html>
L'idée, c'est d'afficher le total de chaque colonne (bonus, buts pour, buts contre, différence) pour chaque équipe dans le fichier index.php. Par exemple, pour le Nouvelle-Zélande, le total de chaque colonne.
Il s'agit des erreurs qui s'affichent.
Merci d'avance.





Répondre avec citation
Partager