salut,
j'ai besoin d'une variable pour stocker la somme de tous les "$prix_ttc" de tous les article inserés . j'ai choisi le type "global" mais a chaque fois le nouveau "$prix_ttc" ecrase l'ancien !!!!

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
if ($submit=="submit")
{
 $sql="SELECT regle FROM facture WHERE num_facture=$fac";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
while( $data = mysql_fetch_assoc($req))
{    $regle=$data['regle'];
}

/****************************************************/

$query="INSERT INTO ligne_facture (num_facture,num_article,quantite,observation,remise,to_tva) 
        VALUES('$fac','$select_serv','$quantite','$comm1','$remise','$to_tva')";
mysql_query($query, $db);


/********************************************/


        if ($regle=="oui")
        {
            
/***********ARCHIVAGE_LG_FACTURE***********************/
            //selection du prix de l'article pour l'archivage
            
            $sql = "SELECT  prix_htva 
                    FROM article 
                    WHERE num_article='$select_serv'";
            $req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
            while( $data = mysql_fetch_assoc($req))
            { 
              $prix_htva=$data['prix_htva'];}
              $save_lg['prix_htva']=$prix_htva;
          
            $total=($prix_htva+(($prix_htva*$to_tva)/100));
            $total_ttc=$total_ttc + ($total-(($total*$remise)/100));
            
            //archivge de linge_devis
            $saved_lg=serialize($save_lg);
            $query="INSERT INTO archivage_lg_facture (id_facture,num_article_fac,lg_facture_saved) 
                    VALUES('$fac','$select_serv','$saved_lg')";
            mysql_query($query, $db);
            /********************************************/
            
        }
}
Merci pour votre aide