Académique Documents
Professionnel Documents
Culture Documents
Merci d'avance
Reponse
Eh bien tu vas d'abord faire une requete en PHP qui récupères toutes les notes de tout le
monde / toute matiere pour un trimestre demandé.
( SELECT.. FROM matable WHERE trimestre = "trismestre voulu" ) Une fois ceci fait,
montre moi le code de ceci, et on avise la suite
J'ai fait un requete qui m'affiche toutes les notes de chaque élève par trimestre et annee:
Voici mon code php :
1 <?php
header('Content-type: text/html; charset=utf-8');
2 ?>
3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5 <html xmlns="http://www.w3.org/1999/xhtml">
6 <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7 <title>Document sans titre</title>
8
9 <link href="assets/css/bootstrap.css" rel="stylesheet" />
10 <!-- FONTAWESOME STYLES-->
<link href="assets/css/font-awesome.css" rel="stylesheet" />
11 <!-- MORRIS CHART STYLES-->
12
13 <!-- CUSTOM STYLES-->
14 <link href="assets/css/custom.css" rel="stylesheet" />
15 <!-- GOOGLE FONTS-->
16 <link href='http://fonts.googleapis.com/css?family=Open+Sans'
rel='stylesheet' type='text/css' />
17 <!-- TABLE STYLES-->
18 <link href="assets/js/dataTables/dataTables.bootstrap.css"
19 rel="stylesheet" />
20 </head>
21
22 <body style="background:#EEEEEE">
<div class="title1"><a href="deconnexion.php">Deconnexion</a></div>
23 <div class="title" style="margin-top:"20px;">DETAIL DES NOTES DE : <?php
24 mysql_connect("localhost", "root", ""); // Connexion à MySQL
25 mysql_select_db("bd_ecole"); // Sélection de la base
26
27 $reponse = mysql_query("SELECT nom, prenoms FROM eleve where
28 matricule='".$_GET['matricule']."' ") or die(mysql_error());
29
mysql_close(); ?>
30
31
32
33
<?php
34 while($donnees = mysql_fetch_array($reponse)) {
35 ?>
36
37
38 <?php echo $donnees['nom']; ?> <?php echo $donnees['prenoms']; ?>
39
40 <?php
}?>
41
42 </div>
43 <script src="assets/js/jquery-1.10.2.js"></script>
44 <!-- BOOTSTRAP SCRIPTS -->
45 <script src="assets/js/bootstrap.min.js"></script>
<!-- METISMENU SCRIPTS -->
46
<script src="assets/js/jquery.metisMenu.js"></script>
47 <!-- DATA TABLE SCRIPTS -->
48 <script src="assets/js/dataTables/jquery.dataTables.js"></script>
49 <script src="assets/js/dataTables/dataTables.bootstrap.js"></script>
50 <script>
$(document).ready(function () {
51 $('#dataTables-example').dataTable();
52 });
53 </script>
54 <!-- CUSTOM SCRIPTS -->
55 <script src="assets/js/custom.js"></script>
<div class="cole">
56
57 <label>
58
59
60 </label>
<div class="panel-body">
61 <div class="table-responsive">
62 <table border="0" cellpadding="0"
63 cellspacing="0" class="table table-striped table-bordered table-hover"
64 id="dataTables-example">
65 <thead>
<tr>
66 <th width="17%">Matricule</th>
67 <th width="14%">Notes</th>
68 <th width="18%">Matieres</th>
69 <th width="12%">Multipliée
70 par</th>
<th width="13%">Classe</th>
71 <th width="12%">Trimestre</th>
72 <th width="12%">Année
73 scolaire</th>
74 </tr>
</thead>
75 <tbody>
76 <tr class="even gradeC">
77 <td><b>
78 <?php
79 require("connexion.php") ;
80
81
$req = mysqli_query($mysqli, "SELECT * FROM notes where matricule='".
82 $_GET['matricule']."' ORDER BY matiere, trimestre AND annee");
83 while ($donnees = mysqli_fetch_array($req)) // On fait une boucle pour
84 lister les informations de la table
85 {
86 ?>
<?php echo stripslashes($donnees['matricule']); ?></b></td>
87 <td align="center"><?php echo
88 stripslashes($donnees['note']); ?></td>
89 <td align="center"><?php echo
90 stripslashes($donnees['matiere']); ?></td>
<td align="center"><?php echo
91 stripslashes($donnees['coef']); ?></td>
92 <td align="center"><?php echo
93 stripslashes($donnees['classe']); ?></font></td>
94 <td align="center"><?php echo
95 stripslashes($donnees['trimestre']); ?></font></td>
<td align="center"><?php echo
96 stripslashes($donnees['annee']); ?></font></td>
97 </tr>
98 <tr class="even gradeC">
99 <td><?php } ?></td>
10 <td
align="center"> </td>
0 <td
10 align="center"> </td>
1 <td
10 align="center"> </td>
<td
2 align="center"> </td>
10 <td
3 align="center"> </td>
10 <td
4 align="center"> </td>
</tr>
10
5
10
6
10
7
10
8
10
9
</tbody>
11 </table>
0 </div>
11
1 </div>
11 </div>
2 <form>
</form>
11 </body>
3 </html>
11
4
11
5
11
6
11
7
11
8
Tu t'embêterais à le faire en PHP alors qu'une simple requête SQL en est capable en groupant
les données et avec un calcul de moyenne en SQL.
-
Edité par Anonyme 29 juillet 2016 à 21:09:16
Essaie ça :