query($fstsql); $cycles = round(count($_POST['sports']) / 3); for ($i=1; $i<=$cycles; $i++) { for ($j=1; $j<=3; $j++) { $list = 3*($i-1)+$j-1; $sql = "INSERT INTO bdsports.programme (NoProgr, LieuNoProgr, PeriodeProgr, ProfNoProgr, SportNoProgr) VALUES ('".($list+1)."', '".$i."','".$j."', '".$_POST['profs'][$list]."', '".$_POST['sports'][$list]."')"; $repclients = $bdd->query($sql); } } } echo "
"; echo "
Programme
"; $query = "SELECT * FROM bdsports.lieux"; $result = $bdd->query($query); echo "
"; echo "
Lieu
Période 1
Période 2
Période 3
"; while($row = $result->fetch()) { echo "
"; echo "
".$row["NomLieu"]."
"; for($i=1; $i<=3; $i++){ $query2 = "SELECT * FROM bdsports.programme WHERE LieuNoProgr = ".$row["NoLieu"]." AND PeriodeProgr=".$i; $result2 = $bdd->query($query2); $row2 = $result2->fetch(); echo "
"; echo "
"; $query3 = "SELECT * FROM bdsports.sports"; $result3 = $bdd->query($query3); echo "
"; while($sports = $result3->fetch()){ echo "
".$sports["NomSport"]; echo "
"; } echo "
"; echo "
"; $query4 = "SELECT * FROM bdsports.profs WHERE Sport=1"; $result4 = $bdd->query($query4); echo "
"; while($profs = $result4->fetch()){ echo "
".$profs["NomProf"]."
"; } echo "
"; echo "
"; } echo "
"; } echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; ?>