<?php
$servername = "49.12.125.236";
$username = "patiltec_anand";
$password = "Asd123!@#";
$dbname = "patiltec_loginsystem1";
$conn = mysqli_connect($servername, $username, $password, $dbname);

	$id =$_REQUEST['id'];

	mysqli_query($conn ,"DELETE FROM postsbyusers WHERE id = '$id'")
	or die(mysqli_error());

   mysqli_query($conn ,"DELETE FROM users WHERE id = '$id'")
	or die(mysqli_error());

  $name = mysqli_query($conn ,"SELECT * FROM postsbyusers WHERE id = '$id'")
	or die(mysqli_error());

  $row= mysqli_fetch_array($name);
  $r = $row['image'];

  $path = "/db71/all/loginsystem1/postsbyusers/images/$r";
  if(!unlink($path))
  {
    echo "Not Working";
  }
  else {
    header("Location: form.php?working");
  }
     header("Location: form.php");
?>

refer:-
https://www.codeproject.com/Questions/5140388/Php-delete-file-from-folder

