Sorry, I normally can figure out PHP and SQL, but this one just confuses me.
So, this is the code I'm using:
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "UpdateRecord")) {
$updateSQL = sprintf("UPDATE SGD_FT SET FileName=%s WHERE FileID=%s",
GetSQLValueString($_POST['FileName'], "text"),
GetSQLValueString($_POST['FileID'], "int"));
mysql_select_db($database_SGD_Database, $SGD_Database);
$Result1 = mysql_query($updateSQL, $SGD_Database) or die(mysql_error());
$updateGoTo = "r3S.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_FileUpdate = "-1";
if (isset($_GET['FileID'])) {
$colname_FileUpdate = (get_magic_quotes_gpc()) ? $_GET['FileID'] : addslashes($_GET['FileID']);
}
mysql_select_db($database_SGD_Database, $SGD_Database);
$query_FileUpdate = sprintf("SELECT * FROM SGD_FT WHERE FileID = %s", $colname_FileUpdate);
$FileUpdate = mysql_query($query_FileUpdate, $SGD_Database) or die(mysql_error());
$row_FileUpdate = mysql_fetch_assoc($FileUpdate);
$totalRows_FileUpdate = mysql_num_rows($FileUpdate);
?>
Where do I put unlink($row_FileUpdate['FileLoc']) ???
The page previous to this displays the data from all rows where FileID=%s, so where FileID=%s should still pull a path relative to the page, but I need to add FDir/ in there somewhere as that's the directory that's the file is in but it's not in the data on the table.