title: Delete file in folder and mysql table
body: <p>I'm trying to delete file in mySQL table and folder simultaneously. So far, I can only delete the file in mysql table but the the same file still exist in the folder. </p>
  
  <p>This is the delete script that I use. </p>
  
  <pre><code>&lt;?php
  
  include "../php/conn.php";
  
  $query = " DELETE FROM fail WHERE id_f = ? ";
  
  if($statement = $conn-&gt;prepare($query)){
  
      $statement-&gt;bind_param("i", $_GET['id_f']);
  
      if($statement-&gt;execute()){
  
      $statement-&gt;close();
  
      echo '&lt;script&gt;window.alert("Fail berjaya dihapuskan.");
      window.location=("../pensyarah/files.php");&lt;/script&gt;';
          }
  
      else {
  
      echo '&lt;script&gt;window.alert("Gagal menghapus fail. Sila cuba lagi.");
      window.location=("../pensyarah/files.php");&lt;/script&gt;';
          }
  }
  
  else {
      echo '&lt;script&gt;window.alert("Gagal menghapus fail. Sila cuba lagi.");
      window.location=("../pensyarah/files.php");&lt;/script&gt;';
          }
      ?&gt;
  </code></pre>
  
  <p>I'm trying to implement the PHP unlink , but i dont know how and where to punt the unlink in the script above. Please help me. Thank you.</p>