<?php 
header("Access-Control-Allow-Headers: Authorization, Content-Type");
header("Access-Control-Allow-Origin: *");
//echo $_GET['npsn'];
$host="localhost";
$username="insansej_user";
$password="xR~^E(@3F;r6";
$conn=@mysqli_connect($host,$username,$password,"insansej_cashless_dbregistrasi");

$npsn=mysqli_real_escape_string($conn,$_POST['npsn']);
$id=mysqli_real_escape_string($conn,$_POST['id']);
$nama=mysqli_real_escape_string($conn,$_POST['nama']);
mysqli_query($conn,"DELETE FROM reg_rfid WHERE npsn='".$npsn."'");
$query2 ="INSERT INTO `reg_rfid` ( `npsn`,`id_anggota`,`rfid`,`nama`, `sts`, `tgl`) VALUES ( '$npsn', '$id','-', '$nama','0', NOW())";

mysqli_query($conn,$query2);
?>