<?php
 
include 'dbconfig.php';
 
// $nopos = $_POST['nopos'];
 $item_code = $_POST['item_code'];
 
// Create connection
 
$conn = mysqli_connect($servername, $username, $password, $dbname);
 
// Check connection
 
if (!$conn) {
 
    die("Connection failed: " . mysqli_connect_error());
 
}
 
 
$query = "delete from tbl_barang where kode='$item_code'";
 
$response = mysqli_query($conn, $query) or die('Error query:  '.$query);
 
$result["errormsg"]="Success";

 
 
if ($response == 1){
 
    echo json_encode($result);
 
}
 
else{
 
    $result["errormsg"]="Fail";
 
    echo json_encode($result);
 
}
 
?>