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
| $compteur = 0;
while ($row_panier = mysql_fetch_assoc($panier) and $compteur <$totalRows_panier)
{
$query_ligne_commande = sprintf("INSERT INTO shop_ligne_commande (commande, article, prix_ht, prix_ttc, quantite, total_ht, total_ttc, frais_port, `option`) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s) ",
GetSQLValueString($row_commande['id'], "int"),
GetSQLValueString($row_panier['article'], "int"),
GetSQLValueString($row_panier['prix_ht'], "double"),
GetSQLValueString($row_panier['prix_ttc'], "double"),
GetSQLValueString($row_panier['quantite'], "int"),
GetSQLValueString($row_panier['total_ht'], "double"),
GetSQLValueString($row_panier['total_ttc'], "double"),
GetSQLValueString($row_panier['frais_port'], "double"),
GetSQLValueString($row_panier['option'], "text"));
$query_produits= sprintf("UPDATE shop_produits SET stock_qty=stock_qty-%s WHERE shop_produits.id=%s",
GetSQLValueString($row_panier['quantite'], "int"),
GetSQLValueString($row_panier['article'], "int"));
mysql_select_db ($database_condom_local, $condom_local);
$Result1 = mysql_query($query_ligne_commande, $condom_local) or die (mysql_error());
$query_suppr_panier = sprintf("DELETE FROM shop_panier WHERE id= '%s'",
GetSQLValueString($row_panier['id'], "int"));
mysql_select_db($database_condom_local, $condom_local);
$Result1 = mysql_query($query_suppr_panier, $condom_local) or die(mysql_error());
$compteur = $compteur+1; |
Partager