".$question."
"; } if($commentaire=="") $commentaire=$row1[commentaire]; $sql2 = "select nombre from Sondage_Stat where idQuestion=".$_POST[question]." AND idChoix=".$row1[idChoix]; $result2 = mysql_query($sql2); $nb_partiel=0; if ($row2 = mysql_fetch_array($result2)) $nb_partiel=$row2[nombre]; echo $row1['choix']." ".$nb_partiel." votes
"; $total_reponse += $nb_partiel; } echo "
Total : ".$total_reponse." votes

"; echo $commentaire."
"; mysql_close($conn); } else { $conn = mysql_connect ("192.168.1.160","sql07934","2qwbe44r") or die("Erreur de connexion à la base de données"); mysql_select_db ("8R6CA43K1",$conn); $sql = "select Sondage_Question.idQuestion, question, idChoix, choix from Sondage_Question, Sondage_Choix where Sondage_Question.idQuestion=Sondage_Choix.idQuestion and Sondage_Question.debut <= CURDATE() and Sondage_Question.fin >= CURDATE() order by idChoix"; $result = mysql_query($sql); $question=""; $commentaire=""; while ($row = mysql_fetch_array($result)) { // Un sondage est en cours if($question=="") { $question=$row[question]; echo "".$question."
"; echo "
"; } echo " ".$row['choix']."
"; echo ""; echo ""; } if($question!="") { echo ""; echo "
"; } mysql_close($conn); } ?>