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
| // sélection des données
$sql = mysql_query("select *, J_Sens * J_Montant AS J_Total from beajournal",$connexion);
// nombre de lignes
$nombreligne = mysql_num_rows($sql);
$Cot = 0;
$TotCot = 0;
$Coup = 0;
$TotCoup = 0;
$i = 0;
while ($i<$nombreligne)
{
$Descrip = mysql_result($sql,$i,"J_C_Description");
if (mysql_result($sql,$i,"J_C_Description") == "Cotisations"){
$Cot = mysql_result($sql,$i,"J_Total");
$TotCot += $Cot;
}
elseif (mysql_result($sql,$i,"J_C_Description") == "Coupons"){
$Coup = mysql_result($sql,$i,"J_Total");
$TotCoup += $Coup;
}
$i++;
}
$TotCot = number_format("$TotCot", 2, ',' ,' ');
$TotCoup = number_format("$TotCoup", 2,',',' ');
echo "$TotCot"; |
Partager