I seem to be confused with implementing the php 'unlink'. I would like to delete the record, plus the file that is associated with it from the server. The file that is associated with it is from 'empl_dnld_fn' field in the dbase.
Can someone look at this and tell me where I'm going wrong?
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_id'])) && file_exists($image_path.$_POST['empl_id'])) {
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'];
}
mysql_select_db($database_wvgsadmin, $wvgsadmin);
$query_getApp = sprintf("SELECT * FROM empl_dnlds WHERE empl_id = %s", GetSQLValueString($colname_getApp, "int"));
$getApp = mysql_query($query_getApp, $wvgsadmin) or die(mysql_error());
$row_getApp = mysql_fetch_assoc($getApp);
$totalRows_getApp = mysql_num_rows($getApp);
Thank you for looking at this for me.
toad78