Bonjours,
J'ai un petit problème j'avais créer un tableau qui me donne les résultats dans différentes bdd ce qui marchait très bien.
j'avais fait une fonction ou j'avait mis tous mon code et en paramètre de ma fonction je changé les différente données suivant les bdd.
j'usqu'à là tou va très bien j'ai fai mes résultats tous marche nickel mais maintenant je veu faire un resultat de tous les résultats de mes différents tableau et là je block depuis plus de 3h et c'est pour celà que je fais appel a votre aide.
donc j'ai deux fonction la première c'est la connextion a la bdd
la deuxième est la création de mon tableau avec son affichage.
voilà mon code pour ma deuxième fonction:
donc jusque là tous va très bien mon tableau s'affiche bien quand je fait l'appel comme celà:
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 <?php // creation de la function function stats_pays($condition, $prefixe ) { // REQUETE 1 : $query = " "; $result_vg = mysql_query($query) ; while ($row = mysql_fetch_array($result_vg)) { // REQUETE 2 : $query_produit = " "; $result = mysql_query($query_produit) ; while ($row1 = mysql_fetch_array($result)) { ?> <tr> <td style="background-color:#CCCCCC;"> </td> <td style="text-align:center;"> <?php echo $row['Origin'] ?> </td> <td style="text-align:center;"> <?php echo $row['effectif_vg'] ?> </td> <td style="text-align:center;"> <?php echo $row1['command'] ?> </td> </tr> <?php $total_command += $row1["command"]; $total_effectif_vg += $row["effectif_vg"]; $total_conv = (($total_command/ $total_effectif_vg) * 100); } } ?> <tr> <td style="background-color:#CCCCCC; text-align: center; font-weight:bold;"> Total </td> <td style="text-align:center;background-color:#CCCCCC;"> </td> <td style="text-align:center; background-color:#CCCCCC; font-weight:bold;"> <?php echo $total_effectif_vg ?> </td> <td style="text-align:center; background-color:#CCCCCC; font-weight:bold;"> <?php echo $total_command ?> </td> <td style="text-align:center; background-color:#CCCCCC; font-weight:bold;"> <?php echo round ($total_conv,2) ?> % </td> </tr> </table> </br></br></br> <?php } ?>
j'ai tous les résultats correct mais maintenant je veu créer un nouveau tableau avec les résultats de
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 <?php connexionBase("localhost","root","mysql", "france") ;?> <?php stats_pays( $condition) ; ?> <?php connexionBase("localhost","root","mysql", "suisse") ;?> <?php stats_pays( $condition) ; ?> <?php connexionBase("localhost","root","mysql", "belgic") ;?> <?php stats_pays( $condition) ; ?>
mais en accumulé donc sur chaque pays france suisse belgic
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 <tr> <td style="background-color:#CCCCCC; text-align: center; font-weight:bold;"> Total </td> <td style="text-align:center;background-color:#CCCCCC;"> </td> <td style="text-align:center; background-color:#CCCCCC; font-weight:bold;"> <?php echo $total_effectif_vg ?> </td> <td style="text-align:center; background-color:#CCCCCC; font-weight:bold;"> <?php echo $total_command ?> </td> <td style="text-align:center; background-color:#CCCCCC; font-weight:bold;"> <?php echo round ($total_conv,2) ?> % </td> </tr> </table>
donc le total de $total_effectif_vg (france) + $total_effectif_vg (suisse) + $total_effectif_vg belgic
mais j'arrive pas à le faire et arrive pas a sortir les résultat en dehor de la fonction.
si quelqu'un(e) pourrait m'aider svp ce serai gentille![]()
Partager