<?php
	session_start();
	require('includes/config.php');
		
	$dtTm               = strtotime(date('d-m-Y'));
	$user               = $_SESSION['userid'];
	$return             = 0;
	$message            = '';	
	$identifier         = $_REQUEST['identifier'];
	$call_back          = $_REQUEST['call_back'];
	$id                 = $_REQUEST['id'];
	$table              = $_REQUEST['table'];
	$active             = $_REQUEST['active'];

	/* soft deletes the record from table */
	//$usql = "UPDATE ". $table." SET active = ".$active.", updated_at = ".$dtTm.", updated_by = ".$user." WHERE ".$identifier." = ".$id;
    $usql="DELETE FROM ". $table." WHERE id = ".$id;	
	$uexe = mysqli_query($con, $usql);
	if( $uexe ) { $return = 1; $message = 'Record deleted successfully'; } else { $return = 0; $message = 'Record deletion failed'; }

	if( $return ){
		echo json_encode( ['code' => 200,'data' => $message, 'url' => $call_back ] );exit;
	}else{
		echo json_encode( ['code' => 405 , 'data' => $message, 'url' => $call_back ] );exit;	
	}
?>