<?php
	
	
	include "koneksi.php";
	$gabung = mysqli_real_escape_string($conn, $_GET["id"]);
	
	$s = "SELECT id FROM data_purchasing_requisition WHERE gabung=".$gabung;
    $res = mysqli_query($conn,$s);
    WHILE ($row = mysqli_fetch_array ($res))
	{
		$id_pr = $row["id"];
	    $query = "INSERT INTO coba_gabung (id_gabungan,id_data_purchasing)
	                                   VALUE 
									   ('$gabung','$id_pr')";
		//							   echo "ini".$query;
        $result = mysqli_query($conn, $query);
	    echo "query = " . $query . "</br>";
	    if($result)
	    {
		   echo "Data berhasil masuk";
		   //header("location:tambahDaftarSuplier.php?p=1");
		   header("location:cetakPrPDFGabung.php");
	    }
	    else
	    {
		   //header("location:tambahDaftarSuplier.php?p=2");
		   die("Error");
		   header ("location:detailHistoryPoGabungan1.php?p=1");
	    }	
	}
	
?>