有人可以帮助我的代码。我可以删除数据库中的图像,但不能删除目录中的图像。我尝试了很长时间,但它似乎根本不起作用。有人可以帮帮我吗?这是我的代码:这是图像所在的代码
<?
//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)){
?>
<a href="edithomephotos.php?delete=<?=$row['imageID']?>" onclick = "return confirm('Are you sure you want to delete?')"><img src="images/template/delete.png" id="AEDbutton"></a>
echo "<img border=\"0\" src=\"".$row['image']."\" width=\"200\" height=\"100\">";
echo "<br>"; }
?>
,?
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);
}
?>