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 ""; while($row = $result->fetch()) { echo ""; echo ""; 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 ""; } echo "
LieuPériode 1Période 2Période 3
".$row["NomLieu"].""; echo ""; echo ""; echo "
"; echo "

"; echo ""; echo "
"; echo "
"; ?>