<?php
include "koneksi.php";
//$ids[]=$row->id;

// var_dump($_POST["id"]);
isset($_POST["id"]);

$a = "SELECT * FROM data_gabungan_pr WHERE id='1'";
$res = mysqli_query($conn, $a);	
$row = mysqli_fetch_assoc($res);
$gabungan = $row["gabungan"];
$hasil = $gabungan;
$tanggal =  date('dmY');
$hasilTanggal = $hasil.$tanggal;

echo"gabungan hasil dan tanggal ".$hasilTanggal."<br>";
echo"hasil ".$hasil."<br>";
$tambah = $hasil + 1;
echo "tambah".$tambah;
$a = 1;

if (isset($_POST["id"])) 
{
    foreach ($_POST["id"] as $id) 
	{
        $q = "UPDATE data_purchasing_requisition SET gabung='$hasilTanggal',jadikan_satu='3' WHERE id=".$id;
        echo $q;
        $insert = mysqli_query($conn, $q);
		
		$tambah = $hasil + 1;
		$d = "UPDATE data_gabungan_pr SET gabungan='$tambah'";
		mysqli_query($conn, $d);	    
		//echo "berhasil";
        			
    }
}
if($a == 1)
	    {
		    //echo "Data periode berhasil masuk";
		   header("location:PrDiprosesPrc.php?pesan=berhasilInput");
	    }
	    else
	    {
		    header("location:PrDiprosesPrc.php?pesan=gagalInput");
		    //die("Error");
	    }


?>