Bonjour a tous,
J'ai actuellement créé un tableau qui affiche les valeurs de la base de donnée.
Je cherche a afficher en dernière ligne de ce tableau le total des différentes colonnes.
Pour cela j'ai créé un deuxième tableau qui affichera les totaux.
Je sais qu'il faut utiliser un "array_sum" mais après plusieurs test je cale.
Quelqu'un aurait une idée ?
Merci a vous.
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 $result = mysqli_query($con,"SELECT * FROM Ca WHERE date LIKE '%$moisp%'"); echo "<table border='1'> <tr > <th bgcolor='#ffffff'>Jours</th> <th bgcolor='#ffffff'>Budget CA France</th> <th bgcolor='#ffffff'>Budget Qte France</th> <th bgcolor='#ffffff'>CA France</th> <th bgcolor='#ffffff'>Qte France</th> <th bgcolor='#ffffff'>Budget CA Inter</th> <th bgcolor='#ffffff'>Budget Qte Inter</th> <th bgcolor='#ffffff'>CA Inter</th> <th bgcolor='#ffffff'>Qte Inter</th> </tr>"; while($row = mysqli_fetch_array($result)) { if ($row['date'] == $JourPrecedent1){ $coloro = "<td bgcolor='#FFBF00' align=center>"; } else { $coloro = "<td bgcolor='#ffffff' align=center>"; } echo "<tr >"; echo $coloro . substr($row['date'],0, 2) . "</td>"; echo $coloro . $row['BudCaGdcptFrance'] . "</td>"; echo $coloro . $row['BudQteGdcptFrance'] . "</td>"; echo $coloro . $row['CaGdcptFrance'] . "</td>"; echo $coloro . $row['QteGdcptFrance'] . "</td>"; echo $coloro . $row['BudCaGdcptInter'] . "</td>"; echo $coloro . $row['BudQteGdcptInter'] . "</td>"; echo $coloro . $row['CaGdcptInter'] . "</td>"; echo $coloro . $row['QteGdcptInter'] . "</td>"; echo "</tr>"; } echo "</table>"; echo "<table border='1'> <tr > <th bgcolor='#ffffff'>Total</th> </tr>"; while($row = mysqli_fetch_array($result)) { if ($row['date'] == $JourPrecedent1){ $coloro = "<td bgcolor='#FFBF00' align=center>"; } else { $coloro = "<td bgcolor='#ffffff' align=center>"; } echo "<tr >"; echo $coloro . substr($row['BudCaGdcptFrance'],0, 2) . "</td>"; echo "</tr>"; } echo "</table>"; }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 25 19545 290852 10052 1294 0 0 26 19545 0 0 1294 0 0 27 19545 0 0 1294 0 0 Total
Partager