<?php
	include 'koneksi.php';
	global $total;
	
	$member_id = $_GET['id_member'];
	$query = mysqli_query($koneksi, "SELECT menu.harga, pemesanan.jumlah FROM menu 
		INNER JOIN (pemesanan INNER JOIN member ON member_id = id_member) ON menu_id= id_menu WHERE member_id= '$member_id'");
	while($row = mysqli_fetch_assoc($query)){
		$jumlah = $row['jumlah'] * $row['harga'];
		$total = $total += $jumlah;
	}
	
	$bukti = $_FILES['bukti']['name'];
	
	move_uploaded_file($_FILES['bukti']['tmp_name'], 'picture/'. $bukti);
	
	mysqli_query($koneksi, "INSERT INTO pembayaran VALUES('', '$member_id', '$total', '$bukti', '') ");
	header('Location: bayar.php?id_member='. $member_id);
?>