<?php require_once('../auth/auth.php');
if (isset($_POST['newwarehouse'])) {
    $newwarehouse=       $_POST['newwarehouse'];
    $getbid=    $_POST['bid'];
     $getbrid=    $_POST['brid'];
    $warehouse_code=   $_POST['warehouse_code'];
    $war_location=      $_POST['war_location'];

    

if ($newwarehouse=='0') {
    mysqli_query($conn,"INSERT INTO business_w_house(`coid`, `bid`,`brid`, `warehouse_code`, `war_location`, `date`, `active`) VALUES ('$coid','$getbid','$getbrid','$warehouse_code','$war_location','$datetime','1')")or die(mysqli_error($conn));
} else if($newwarehouse >0){
mysqli_query($conn,"UPDATE business_w_house SET warehouse_code='$warehouse_code', war_location='$war_location',bid='$getbid',brid='$getbrid' WHERE bwid='$newwarehouse'");
echo "update"; 

}

}       
?>