bonjour, j'ai écrit une requete sql avec des boucles if mais ça ne marche pas je ne sais pas pourquoi
aidez moi SVP!!!

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
$licences= $HTTP_POST_VARS['licences'];
$journees= $HTTP_POST_VARS['journees'];
 
$req1="CREATE table total as  SELECT COUNT( NuminventaireCHU ) AS quantite_totale_par_article_sorties33, specialite.nom_specialite
FROM article, materiel, specialite
WHERE materiel.id_materiel = article.materiel_idmateriel
AND specialite.idspecialite = article.id_specialite
GROUP BY nom_specialite";
$reponse1 = mysql_query($req1);
while ( $donnees1 = mysql_fetch_array($reponse1) )
{
// on le multiplie directement
	$quantite_totale_par_article_sorties33[] = $donnees1['$quantite_totale_par_article_sorties33'];
	for($i=0;$i<sizeof($quantite_totale_par_article_sorties33);$i++) // tant que $i est inferieur au nombre d'éléments du tableau... 
    { 
	 if ($quantite_totale_par_article_sorties33[$i] >= 1 && $quantite_totale_par_article_sorties33[$i] < 10) // on affiche l'élément du tableau d'indice $i 
	{
		$journees = $journees * 2;
		$licences = $licences * ($quantite_totale_par_article_sorties33 / 2);
	}	
    elseif ($quantite_totale_par_article_sorties33[$i] >= 10 && $quantite_totale_par_article_sorties33[$i] < 20) // on affiche l'élément du tableau d'indice $i 
	{
		$journees = $journees * 5;
		$licences = $licences * ($quantite_totale_par_article_sorties33 / 2);
	}
	elseif ($quantite_totale_par_article_sorties33[$i] >= 20 && $quantite_totale_par_article_sorties33[$i] < 30) // on affiche l'élément du tableau d'indice $i 
	{
		$journees = $journees * 8;
		$licences = $licences * ($quantite_totale_par_article_sorties33 / 2);
	}
	elseif ($quantite_totale_par_article_sorties33[$i] >= 30 && $quantite_totale_par_article_sorties33[$i] < 65) // on affiche l'élément du tableau d'indice $i 
	{
		$journees = $journees * 15;
		$licences = $licences * ($quantite_totale_par_article_sorties33 / 2);
	}
    } 
}	
?>