Mon code:
CODE
$req2 = mysql_query("SELECT SUM(montant) AS total FROM matable WHERE YEAR(o_timestamp) = 2006 and statut = '0' GROUP BY MONTH(o_timestamp)");
$retour = mysql_query("SELECT COUNT(*) AS nbre_entrees FROM matable WHERE YEAR(o_timestamp) = '2006' and statut = '0' GROUP BY MONTH(o_timestamp)");
while($data2 = mysql_fetch_object($req2)) {
$lolo = sprintf("%01.1f0",($data2->total/1.196));
print '<td bgcolor="#BBF9B9"><b>'.$lolo.'</b><br><br></td>';
}
echo '</tr><tr><td bgcolor="#EEEEEE">Nbre de commandes</td>';
while($donnees = mysql_fetch_object($retour)) {
$coms = $donnees->nbre_entrees;
print '<td>'.$coms.'</td>';
}
$retour = mysql_query("SELECT COUNT(*) AS nbre_entrees FROM matable WHERE YEAR(o_timestamp) = '2006' and statut = '0' GROUP BY MONTH(o_timestamp)");
while($data2 = mysql_fetch_object($req2)) {
$lolo = sprintf("%01.1f0",($data2->total/1.196));
print '<td bgcolor="#BBF9B9"><b>'.$lolo.'</b><br><br></td>';
}
echo '</tr><tr><td bgcolor="#EEEEEE">Nbre de commandes</td>';
while($donnees = mysql_fetch_object($retour)) {
$coms = $donnees->nbre_entrees;
print '<td>'.$coms.'</td>';
}
la première requète me permet d'avoir mois par mois le montant total des commandes, la deuxième me permet d'avoir le nombre de commandes, et maintenant je bloque pour afficher a partir de la première et la deuxième requète mon panier moyen (première requete divisé par deuxième requete) puisque j'ai deux boucle "while" indépendantes.
Vous avez une idée?
