Bonjours,
j'ai un problème avec ma fonction je sais pas si c'est le paramètre que je mets ou si c'est comme j'ai fait ma fonction qui marche pas???
Là je crée ma fonction
et là je la demande
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
56
57
58
59 <?php function stats_pays($condition) { $prefixe_query=mysql_query("SELECT sites_encodage FROM sites"); while ($prefixe_values=mysql_fetch_array($prefixe_query)) { $prefixe=$prefixe_values["sites_encodage"].'_'; } // REQUETE 1 : $query = "SELECT substr(customers_from, 1, 5) AS Origin, COUNT(customers_id) AS effectif_vg FROM ".$prefixe."customers cu WHERE customers_from NOT LIKE '<%' " . $condition . " GROUP BY Origin "; $result_vg = mysql_query($query) ; while ($row = mysql_fetch_array($result_vg)) { // REQUETE 2 : $query_produit = " SELECT count(co.commandes_status) AS command, AVG(co.commandes_montant) AS Mmc FROM ".$prefixe."customers cu INNER JOIN ".$prefixe."commandes co ON cu.customers_id=co.customers_id WHERE co.commandes_status='1' and customers_from LIKE '{$row['Origin']}%' " . $condition . " "; if ($row['Origin'] == '') { $query_produit = " SELECT count(co.commandes_status) AS command, AVG(co.commandes_montant) AS Mmc FROM ".$prefixe."customers cu INNER JOIN ".$prefixe."commandes co ON cu.customers_id=co.customers_id WHERE co.commandes_status='1' and customers_from = '' " . $condition . " "; } $result = mysql_query($query_produit) ; while ($row1 = mysql_fetch_array($result)) { } ?>
et a la suite je met l'affichage
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2<?php stats_pays($condition); ?>
et quand je fais sa sa me met une page blanche??
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 <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> <td style="text-align:center;"><?php echo round(($row1['command'] / $row['effectif_vg']) * 100, 2); ?> % </td> <td style="text-align:center;"> <?php echo round($row1['command']*$row1['Mmc']) ?> € </td> <td style="text-align:center;"> <?php echo round($row1['Mmc'] ,2) ?> € </td> <?php } } ?> </tr> </table>
si jamais j'ai mis dans mes paramètre de ma fonction function stats_pays($condition)
$condition car je doit prendre cette infos dans
if (isset($date_au) && $date_au !='') {
$condition .= " AND customers_date_inscription<='" . $date_au . "' ";
}
Partager