<?php
 
include 'dbconfig.php';
 
// Create connection

 
$idno=$_POST['idno'];
 
 

//echo $notrans;
 
$conn = mysqli_connect($servername, $username, $password, $dbname);
 
// Check connection
 
if (!$conn) {
 
    die("Connection failed: " . mysqli_connect_error());
 
}

 


 
 

//$response = mysqli_query($conn, $query) or die('Error query:  '.$query);

$res=mysqli_query($conn,"select name_file from tbpict where idno='$idno'");
$res2=mysqli_fetch_row($res);
unlink('uploadpict/'.$res2[0].'.jpg');

$sql1=mysqli_query($conn,"delete from tbpict where idno='$idno'");

 if (mysqli_num_rows($res)==0)
  {
    $result['message']='ok';
  }
 
echo json_encode($result);
 
//$sql1->close(); 
mysqli_close($conn);

 
?>