<?php
    include "koneksi.php";
    $id_pemenang = $_GET['id_pemenang'];
    $id_voucher_pemenang = $_GET['id_voucher_pemenang'];
    $id_hadiah_pemenang = $_GET['id_hadiah_pemenang'];
    $proses = mysqli_query($koneksi, "DELETE FROM pemenang WHERE id_pemenang = '$id_pemenang'");
    if ($proses) {
        $proses2 = mysqli_query($koneksi, "UPDATE voucher SET id_hadiah_voucher = '0', status_voucher = 'Belum Digunakan' WHERE id_voucher = '$id_voucher_pemenang'");
        if ($proses2) {
            header("location: index.php?page=pemenang&notif=berhasil_hapus_data");
        } else {
            echo "Proses Gagal<br>Error : ".$proses2."<br>".mysqli_error($koneksi);
        }
    } else {
        echo "Proses Gagal<br>Error : ".$proses."<br>".mysqli_error($koneksi);
    }
?>