<?php 	

require_once '../../Server/connection.php';


$valid['success'] = array('success' => false, 'messages' => array());

$productId = $_POST['productId'];

if($productId) { 


 $sql = "DELETE FROM assigned_permissions WHERE user_id = {$productId}";
 
 
 $sql1 = "DELETE FROM users WHERE user_id = {$productId}";
 
 

 if($conn->query($sql) === TRUE && $conn->query($sql1) === TRUE){
 	$valid['success'] = true;
	$valid['messages'] = "User is successfully Deleted";		
 } else {
 	$valid['success'] = false;
 	$valid['messages'] = "Error while Deleting User";
 }
			
			
		   


 $conn->close();

 echo json_encode($valid);
 
} // /if $_POST