Commit bc5444d5 by DESKTOP-4R50ASQ\DELL

Pembayaran

parent 351fd025
<?php
//session_start();
include_once 'functions/fungsi.php';
include_once 'connection/koneksi.php';
$query = "SELECT menu.harga as harga, pesanan.jumlah as jumlah FROM pesanan INNER JOIN menu ON pesanan.id_menu = menu.id";
$result_set = $database->query($query);
?>
<body>
<div class="checkout grid_16">
<div class="billInfo grid_11 alpha">
<h4>Daftar Pesanan</h4><br>
</div>
</div>
<br>
<p>
<table border="2px">
<tr>
<td>Total harga</td>
</tr>
<?php
$total = 0;
while ($row = $result_set->fetch_array()) {
$total = $total + ($row['harga'] * $row['jumlah']);
}
?>
<tr><td><?= $total ?></td></tr>
</table>
<a href="bayar_process.php?harga=<?= $total ?>">oke</a>
</p>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</body>
\ No newline at end of file
<?php
session_start();
include_once 'functions/fungsi.php';
include_once 'connection/koneksi.php';
$id = get_session('id');
mysqli_query($database, "DELETE FROM pesanan WHERE id_user=$id");
$harga = $_GET['harga'];
$id = get_session('id');
$query = 'INSERT INTO pembayaran( `id_user`, `total`) VALUES(?, ?)';
$statement = $database->prepare($query);
$statement->bind_param('is', $id, $harga);
$statement->execute();
redirect('index.php#pembayaran');
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment