我有一个表,将图像名称存储在表中,并将文件存储在服务器上的文件夹中。我想要做的是能够从数据库中删除记录,同时从服务器上的文件夹中删除其名称在表记录中的相应图像。任何帮助将不胜感激以下是代码:
if ((isset($_POST['hiddenFieldID'])) && ($_POST['hiddenFieldID'] != "")) {
$deleteSQL = sprintf("DELETE FROM photodiary WHERE pdiaryID=%s",
GetSQLValueString($_POST['hiddenFieldID'], "int"));
mysql_select_db($database_connMain, $connMain);
$Result1 = mysql_query($deleteSQL, $connMain) or die(mysql_error());
$deleteGoTo = "adphotodiary.php?user=" . $row_rsadmin['adID'] . "";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}