我的目标是只展示一个' matiere'和所有的人一起,但我得到了每一个人的感觉。为每个人提供重复的信息。我需要隐藏这些,而不是删除它们。
老师可以添加一个“产品”。与他们的模块devoir',这意味着'模块'每次都与'devoir'重复。
PHP:
echo"<br><button class='btn btn-info cursor' name='butAf'>Afficher</button>";
if(isset($_POST['butAf']))
{
/*ID_CLASS and ID_ANNEE just to filter the class and the year of study*/
$query5 = "select * from devoir inner join prof_an_cls on prof_an_cls.ID_PROF_AN_CLS = devoir.ID_PROF_AN_CLS where CIN_ELEVE = '$cinE' and ID_ANNEE=$ID_ANNEE and ID_CLASS = $ID_CLASS";
$result5 = mysqli_query($con,$query5);
if(mysqli_num_rows($result5)>0)
{
echo"<table class='table table-bordered table-striped table-hover table-info'><tr>
<th>MATIERE</th>
<th>devoir1</th>
<th>devoir2</th>
<th>devoir3</th>
<th>devoir4</th>
<th>devoir5</th>
</tr>
";
while($rows = mysqli_fetch_assoc($result5))
{/*i guess this loop its the reason of duplicating */
$moduleD = $rows['MODULE_DEVOIR'];
$queryDEV = "select * from devoir inner join eleve on devoir.CIN_ELEVE = eleve.CIN_ELEVE where eleve.CIN_ELEVE = '$cinE' and MODULE_DEVOIR = '$moduleD' order by MODULE_DEVOIR";
$resultDEV = mysqli_query($con,$queryDEV);
echo"<tr><td>$moduleD</td>";
while($rows = mysqli_fetch_assoc($resultDEV))/*loop2*/
{
$noteDEV = $rows['NOTE_DEVOIR'];
echo"<td>$noteDEV</td>";
}
echo"</tr>";
}
echo"</table>";
}
}