title: php delete multiple images from directory
body: <p>for some reason my php script doesn't delete multiple images, it just delete the thumbnail image then leaves the second one in the directory.</p>
  
  <pre><code>if($_POST['pic_id']){
  
      $pic_id = $_POST['pic_id'];
      $pic_id = mysql_escape_String($pic_id);
  
      # Select photo details from database
      $query = mysql_query("SELECT * FROM gallery WHERE id='$pic_id'");
      $queryCount = mysql_num_rows($query);
  
      if($queryCount&gt;0){
  
      #Get the fields
      while($row = mysql_fetch_array($query)){         
      $image= $row["image"];
      $thumbnail = $row["thumbnail"];
  
      }
  
      # Unlink thumb source
      //Delete the thumbnail photo from directory
      $pic1 = ("$image");
      if (file_exists($pic1)) {
      unlink($pic1);
      }
      # Unlink resize source
      //Delete the big photo from directory
      $pic2 = ("$thumbnail");
      if (file_exists($pic2)) {
      unlink($pic2);
      }
  
  
      # Delete the row from the database
      $sqlTable2 = mysql_query("DELETE FROM gallery WHERE id='$pic_id'"); 
  
      } else {
  
          exit();
      }
  
   }   
  </code></pre>
  
  <p>Been trying for days to get it working, any ideas appreciated. </p>