title: delete images through database and directory
body: <p>can somebody help me for my codes. i can delete the image in the database but in the directory i can't. im tried for long hours but it seems not work at all. would somebody help me please?          here's my code:     this is the code where the images</p>
  
  <pre><code>&lt;?
  //this is were images displayed
                      $query = "SELECT * FROM images WHERE category='home'";
                      $result = mysql_query($query) or die(mysql_error());
                      while($row = mysql_fetch_array($result)){
                      ?&gt;
                      &lt;a href="edithomephotos.php?delete=&lt;?=$row['imageID']?&gt;" onclick = "return confirm('Are you sure you want to delete?')"&gt;&lt;img src="images/template/delete.png" id="AEDbutton"&gt;&lt;/a&gt;
  
  
                      echo "&lt;img border=\"0\" src=\"".$row['image']."\" width=\"200\"  height=\"100\"&gt;";
                      echo "&lt;br&gt;";                }   
  
  
  ?&gt;
  </code></pre>
  
  <p>,?</p>
  
  <pre><code>include('global.php');
  
  //this is were image were deleted
  
  if($delete != "") 
  
  
  
      {
  
          $query = "DELETE FROM images WHERE imageID='".$delete."'";
          ExecuteQuery($query);   
  
  }
  
  //but in here , it cannot delete image through directory
             $query = "SELECT * FROM images WHERE imageID='".$delete."'";
  
                  $result = mysql_query($query);
  
  while ($delete = mysql_fetch_array($result)) {
                  $image = $delete['image'];
  
                   $file= '/.directory/'.$image;
  
                          unlink($file);
  
  
      }
  
  
  
  ?&gt;
  </code></pre>