$c_id = $c_grade = 0;
while($donnees=mysql_fetch_array($reponse))
{
//array des questions
$question_reponse[$c_id]=$donnees[radio_texte_reponse];
if ($donnees[id_reponse]!=0)
{
echo"$donnees[id_reponse] : $donnees[radio_texte_reponse] |||| ";
$c_id++;
}
//compter le nombre de grades
if ($donnees[id_reponse]!=0)
{
$c_grade=$donnees[radio_texte];
}
//boucle pour compter combien de fois apparait chaque grade
$i=0;
while ($i<$c_grade)
{
//rajout de 1 si la réponse est égale au numéro de clé de l'array
if($c_chaque_grade[$i]==$donnees[radio_texte_reponse])
{
$c_chaque_grade[$i]++;
}
$i++;
}
}
$sql="select * from tk_tbl_options where id_sondage='".$id_sondage."' ";
$reponse2=mysql_query("$sql") or die( "erreur table options dans |||||||
$sql " .mysql_error());
$donnees2=mysql_fetch_array($reponse2);
$c_grade=$donnees2[radio_texte];
$maxquestions=array_count_values($question_reponse);
print_r($question_reponse);
$compt_while=$compt_while2=0;
while ($compt_while<$c_grade)
{
while ($compt_while2<$c_id){
$sql2="select count(*) as nbre_radio_texte from tk_tbl_reponse where id_sondage_reponse='".$id_sondage."' and radio_texte_reponse='".$compt_while."' and radio_name_reponse='".$question_reponse[$compt_while2]."' ";
$reponse2=mysql_query("$sql2") or die( "erreur table reponse dans |||||||
$sql2 " .mysql_error());
$donnees2=mysql_fetch_array($reponse2);
echo"votes pour $compt_while : $donnees2[nbre_radio_texte]
";
$compt_while2++;}
$compt_while++;
}
echo "c_grade: $c_grade
";
echo"
il y a $c_id réponses au sondage
";
print_r($c_chaque_grade);