edit

parent e24d8e77
...@@ -122,25 +122,24 @@ ...@@ -122,25 +122,24 @@
</thead> </thead>
<?php <?php
require_once(dirname(__FILE__ ).'/fungsi.php'); require_once(dirname(__FILE__ ).'/fungsi.php');
$query = mysqli_query($conn, "SELECT * FROM pembayaran"); $query = mysqli_query($conn, "SELECT * FROM `pemesanan` INNER JOIN pembayaran ON pemesanan.id = pembayaran.id_pemesanan
$queryy = mysqli_query($conn, "SELECT * FROM pemesanan"); ");
$dataa = mysqli_fetch_assoc($queryy);
//jika data tidak kosong, maka akan melakukan perulangan while //jika data tidak kosong, maka akan melakukan perulangan while
$no = 1; //membuat variabel $no untuk membuat nomor urut $no = 1; //membuat variabel $no untuk membuat nomor urut
while ($data = mysqli_fetch_assoc($query)) while ($data = mysqli_fetch_array($query))
{ //perulangan while dg membuat variabel $data yang akan mengambil data di database { //perulangan while dg membuat variabel $data yang akan mengambil data di database
//menampilkan row dengan data di database //menampilkan row dengan data di database
echo '<tr>'; echo '<tr>';
echo '<td style="text-align:center">'.$data['id_pemesanan'].'</td>'; echo '<td style="text-align:center">'.$data['id_pemesanan'].'</td>';
echo '<td>'.$dataa['namalengkap'].'</td>'; echo '<td>'.$data['namalengkap'].'</td>';
echo '<td>'.$dataa['alamat'].'</td>'; echo '<td>'.$data['alamat'].'</td>';
echo '<td>'.$dataa['email'].'</td>'; echo '<td>'.$data['email'].'</td>';
echo '<td style="text-align:center">'.$dataa['jumlahpeserta'].'</td>'; echo '<td style="text-align:center">'.$data['jumlahpeserta'].'</td>';
echo '<td>'.$dataa['waktumulai'].'</td>'; echo '<td>'.$data['waktumulai'].'</td>';
echo '<td>'.$dataa['waktuselesai'].'</td>'; echo '<td>'.$data['waktuselesai'].'</td>';
echo '<td style="text-align:center" >'.$dataa['namaruangan'].'</td>'; echo '<td style="text-align:center" >'.$data['namaruangan'].'</td>';
echo '<td><img src="gambar/'.$data['bukti'].'"style="width:200px"></td>'; echo '<td><img src="gambar/'.$data['bukti'].'"style="width:200px"></td>';
echo '<td> echo '<td>
......
...@@ -10,7 +10,12 @@ $bukti = $_FILES['gambar']['name']; ...@@ -10,7 +10,12 @@ $bukti = $_FILES['gambar']['name'];
move_uploaded_file($_FILES['gambar']['tmp_name'], 'gambar/' .$bukti); move_uploaded_file($_FILES['gambar']['tmp_name'], 'gambar/' .$bukti);
mysqli_query($conn, "INSERT INTO pembayaran VALUES('', '$id_pemesanan', '$total', '$bukti', '')"); $action = mysqli_query($conn, "INSERT INTO pembayaran VALUES('', '$id_pemesanan', '$total', '$bukti', '')");
header('Location: pembayaran.php?id='. $id_pemesanan);
if(!$action){
echo mysqli_error();
}
else{
echo "<script>alert('berhasil');window.location.href='pembayaran.php';</script>";
}
?> ?>
\ No newline at end of file
...@@ -21,11 +21,12 @@ $id = $_GET['id']; ...@@ -21,11 +21,12 @@ $id = $_GET['id'];
$query = mysqli_query($conn,"SELECT * FROM pembayaran INNER JOIN pemesanan ON pembayaran.id_pemesanan = pemesanan.id where id_pemesanan = '$id'"); $query = mysqli_query($conn,"SELECT * FROM pembayaran INNER JOIN pemesanan ON pembayaran.id_pemesanan = pemesanan.id where id_pemesanan = '$id'");
$row = mysqli_fetch_array($query); $row = mysqli_fetch_array($query);
if($row['bukti'] == NULL && $row['status'] == NULL){ if($row['bukti'] == NULL && $row['status'] == NULL){?>
echo '<form action="konfirmasi.php?id=<?= $id_pemesanan?>" method="POST" enctype="multipart/form-data" > <form action="konfirmasi.php?id=<?php echo $id;?>" method="POST" enctype="multipart/form-data">
<input type="file" style="width:200px" name="gambar"> <input type="file" style="width:200px" name="gambar">
<input type="submit" name="submit" class="btn btn-info" value="Pesan Sekarang" > <input type="submit" name="submit" class="btn btn-info" value="Pesan Sekarang" >
</form>'; </form>';
<?php
} }
else if($row['bukti'] != NULL && $row['status'] == NULL){ else if($row['bukti'] != NULL && $row['status'] == NULL){
echo '<center> <h1> Terimakasih telah membayar. </h1>'; echo '<center> <h1> Terimakasih telah membayar. </h1>';
......
...@@ -26,5 +26,9 @@ include_once('fungsi.php'); ...@@ -26,5 +26,9 @@ include_once('fungsi.php');
header('Location: konfirmasipemesanan.php?id_kamar='. $id_kamar); header('Location: konfirmasipemesanan.php?id_kamar='. $id_kamar);
} }
if($memesan){
echo mysqli_error();
}
?> ?>
\ 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