Question
Using Unlink
I'd like to know if this is the correct method to use unlink
to delete
the file associated with the record:
if ((isset($_POST['empl_id'])) && ($_POST['empl_id'] != "")) {
$deleteSQL = sprintf("DELETE FROM empl_dnlds WHERE empl_id=%s",
GetSQLValueString($_POST['empl_id'], "int"));
$image_path = '../../../info/docs/employment/';
if ((isset($_POST['empl_dnld_fn'])) &&
file_exists($image_path.$_POST['empl_dnld_fn'])) {
unlink($image_path.$_POST['empl_dnld_fn']);
}
mysql_select_db($database_wvgsadmin, $wvgsadmin);
$Result1 = mysql_query($deleteSQL, $wvgsadmin) or die(mysql_error());
$deleteGoTo = "empl_app_list.php";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
$colname_getApp = "-1";
if (isset($_GET['empl_id'])) {
$colname_getApp = $_GET['empl_id'];
}
the file associated with the record:
if ((isset($_POST['empl_id'])) && ($_POST['empl_id'] != "")) {
$deleteSQL = sprintf("DELETE FROM empl_dnlds WHERE empl_id=%s",
GetSQLValueString($_POST['empl_id'], "int"));
$image_path = '../../../info/docs/employment/';
if ((isset($_POST['empl_dnld_fn'])) &&
file_exists($image_path.$_POST['empl_dnld_fn'])) {
unlink($image_path.$_POST['empl_dnld_fn']);
}
mysql_select_db($database_wvgsadmin, $wvgsadmin);
$Result1 = mysql_query($deleteSQL, $wvgsadmin) or die(mysql_error());
$deleteGoTo = "empl_app_list.php";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
$colname_getApp = "-1";
if (isset($_GET['empl_id'])) {
$colname_getApp = $_GET['empl_id'];
}
