有人可以幫我處理我的代碼。我可以刪除數據庫中的圖像,但在目錄中我不能。即時通訊嘗試了很長時間,但它似乎根本不工作。請有人幫助我嗎?這裏是我的代碼:這是代碼,其中的圖像通過數據庫和目錄刪除圖像
<?
//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);
}
?>
你應該先$替換刪除與$ _REQUEST [」刪除'] – axel
你確實意識到你在刪除記錄後執行'SELECT'語句? –
這正是我爲什麼使用galleryproject [http://galleryproject.org/gallery_3_begins]爲我的後端的東西 – Strawberry