bonjour!
je travaille en ce moment sur un projet de site qui vends des produits informatiques.
j'ai pour affichage des articles achetés par le client, un tableau pour chaque produit.
ce que je voudrais c'est avoir un seul tableau pour tous les produits.
voici le code :
donc avec ce code j'ai un tableau pour chaque produit acheté.
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 $req1 = "SELECT ref_produit, prix_produit FROM produit WHERE designation_produit = '".$article."'"; $query1 = mysql_query($req1); $fetch1 = mysql_fetch_array($query1); $total = $fetch1[1]*$quantite; $inser = "INSERT INTO panier (id_cli, ref_produit, quantite, total) VALUES ( '".$_SESSION['id_client']."','".$fetch1[0]."', '".$quantite."', '".$total."')"; $inquer = mysql_query($inser); $affected = mysql_affected_rows(); $reqtot = "SELECT sum(total) FROM panier WHERE id_cli = '".$_SESSION['id_client']."' "; $querytot = mysql_query($reqtot); $fetchtot = mysql_fetch_array($querytot); $select = "SELECT ref_produit, quantite, total FROM panier WHERE id_cli = '".$_SESSION['id_client']."' "; $quersel = mysql_query($select); while($fetchsel = mysql_fetch_array($quersel)) { $selectdesi = "SELECT designation_produit, prix_produit FROM produit WHERE ref_produit = '".$fetchsel[0]."'"; $querdesi = mysql_query($selectdesi); while ($fetchdesi = mysql_fetch_array($querdesi)) { echo "<table border= 2> <tr> <td>Designation</td> <td>Quantite</td> <td>Prix</td> <td>Total produit</td> <td>Total</td> </tr> <tr> <td>".$fetchdesi[0]."</td> <td>".$fetchsel[1]."</td> <td>".$fetchdesi[1]."</td> <td>".$total."</td> <td>".$fetchtot[0]."</td> </tr> </table> "; } }
quelqu'un peut il m'aider?
merci beaucoup..
Partager