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
   | // recuperation des informations sur les produits du panier //
$nb_ligne = count($_SESSION['panier_id']);
 
$total = 0;
$i = 0;
for ($i; $i < $nb_ligne; $i++) {
        $id = $_SESSION['panier_id'][$i][0];   // id du produit
        $qte = $_SESSION['panier_id'][$i][1]; // qte choisi
 
        echo $id."<br>";
        echo $qte."<br>"."<br>";
 
        $sql_pdt = "SELECT * FROM produit WHERE id_prod = '$id'";
        $query_pdt = mysql_query($sql_pdt);
        $res_pdt = mysql_fetch_array($query_pdt);
 
        $temp_prix = $res_pdt['prix_ttc'];
        $total = $total + $qte*$temp_prix;
 
 
 
        // insertion des produits dans la table commande  //
        $sql_insert = "INSERT INTO panier VALUES
                       (
                       '$id_panier_grande',
                       '".$res_pdt['centrale_achat']."',
                       '".$res_pdt['reference']."',
                       '".$res_pdt['marque']."',
                       '".$res_pdt['nom']."',
                       '".$res_pdt['poids']."',
                       '$qte',
                       '".$res_pdt['prix_ttc']."'
                       ) ";
 
        mysql_query($sql_insert);
} |