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
   | $enrg_com = $bdd->prepare('INSERT INTO odl_commandes (ref_commande,id_membre,total_prod_ht_initial, total_prod_ht,total_prod_ttc_initial, total_prod_ttc,livraison_ht, livraison_ttc,tot_gen_ht_initial,tot_gen_ttc_initial, pourcentage_promo, reduction_ht,reduction_ttc, tot_gen_ht, tot_gen_ttc, time, moyen_paiement, payment_status, num_carte, adresse_liv_num) VALUES(:num_transaction,:id_utilisateur,:total_prodht_ini,:tot_ht,:total_prodttc_init,:tot_ttc,:tarif_liv_ht,
				:tarif_liv_ttc,:tot_genht_ini,:tot_genttc_ini,:pour_promo,:remise_promo_ht,:remise_promo_ttc,
				:gen_ht,:gen_ttc,:vads_trans_date,:type_paiement,:status,:carte_num,:num_adresse)');
				$enrg_com->bindValue('num_transaction', $transaction_num, PDO::PARAM_INT);
				$enrg_com->bindValue('id_utilisateur', $vads_cust_id, PDO::PARAM_INT);
				$enrg_com->bindValue('total_prodht_ini', $tot_ht_ini, PDO::PARAM_STR);
				$enrg_com->bindValue('tot_ht', $tot_ht, PDO::PARAM_STR);
				$enrg_com->bindValue('total_prodttc_init', $tot_ttc_ini, PDO::PARAM_STR);
				$enrg_com->bindValue('tot_ttc', $tot_ttc, PDO::PARAM_STR);
				$enrg_com->bindValue('tarif_liv_ht', $tarif_livraison_ht, PDO::PARAM_STR);
				$enrg_com->bindValue('tarif_liv_ttc', $tarif_livraison_ttc, PDO::PARAM_STR);
				$enrg_com->bindValue('tot_genht_ini', $total_gen_ht_ini, PDO::PARAM_STR);
				$enrg_com->bindValue('tot_genttc_ini', $total_gen_ttc_ini, PDO::PARAM_STR);
				$enrg_com->bindValue('pour_promo', $promo, PDO::PARAM_STR);
				$enrg_com->bindValue('remise_promo_ht', $remise_promo_ht, PDO::PARAM_STR);
				$enrg_com->bindValue('remise_promo_ttc', $remise_promo, PDO::PARAM_STR);
				$enrg_com->bindValue('gen_ht', $total_gen_ht, PDO::PARAM_STR);
				$enrg_com->bindValue('gen_ttc', $total_gen_ttc, PDO::PARAM_STR);
				$enrg_com->bindValue('vads_trans_date', $vads_trans_date, PDO::PARAM_STR);
				$enrg_com->bindValue('type_paiement', $vads_card_brand, PDO::PARAM_STR);
				$enrg_com->bindValue('status', $status, PDO::PARAM_STR);
				$enrg_com->bindValue('carte_num', $vads_card_number, PDO::PARAM_STR);
				$enrg_com->bindValue('num_adresse', $num_adresse, PDO::PARAM_INT);
				try {
						$enrg_com->execute();
						$num_commande = $bdd->lastInsertId();
						echo 'odl_commandes OK '.$transaction_num.'';
					}
				catch (PDOException $e) {
						echo'Un problème est survenu INSERT INTO odl_commandes';
						echo 'Erreur : '.$e->getMessage().'<br />';
						echo 'Num° : '.$e->getCode();
						exit();
					}
				$enrg_com->closeCursor();
				$sql = "DELETE FROM odl_commandes_en_cours WHERE id_membre = :id_client";
				$stmt = $bdd->prepare($sql);
				$stmt->bindParam(':id_client', $vads_cust_id, PDO::PARAM_INT); 
				try
					{
						$stmt->execute();
					}
				catch ( Exception $err )
					{
						echo'Un problème est survenu DELETE FROM odl_commandes_en_cours';
						echo 'Erreur : '.$err->getMessage().'<br />';
						echo 'Num° : '.$err->getCode();
						exit();
					}
				$stmt->CloseCursor(); | 
Partager