Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include 'koneksi.php';
- $username=$_SESSION['username'];
- $id_produk = $_GET['id'];
- $total=0;
- $jumlah=0;
- $tanggal=date('Y-m-d');
- $query="SELECT * FROM produk WHERE id_produk='$id_produk'";
- $hasil=mysqli_query($koneksi,$query);
- while ($pecah=mysqli_fetch_array($hasil)) {
- $jumlah++;
- $subharga=$pecah["harga_baru"]*$jumlah;
- $ambil=$koneksi->query("SELECT * FROM ongkir");
- while ($pecah2=$ambil->fetch_assoc()){
- $total=$subharga+$ongkir; };
- };
- $querycart="INSERT INTO transaksi (qty,subharga,ongkir,total,username,tanggal) VALUES ( '$jumlah', '$subharga', '$ongkir', '$total','$username', '$tanggal' )";
- $hasilcart=mysqli_query($koneksi,$querycart);
- if ($hasilcart) {
- header('location:nota.php');
- } else {
- echo "Gagal tambah produk";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement