Jump to content

Unlink problem


182x

Recommended Posts

Hey guys, the following code removes a record from the database but it wont remove the file related to the record which is obtained form the fileLocation field which is a path such as ../files/test.doc. I was just wondering how to fix this? Thanks.

 

$del="SELECT fileLocation  FROM em WHERE emp = $pr";
	$re = mysql_query($de, $link_id)or die(mysql_error()); 

	$g=mysql_fetch_array($re);

	if (empty($g))

	{
	$de="DELETE FROM em WHERE emp = $pr;
	$re= mysql_query($de, $link_id)or die(mysql_error());

	}
	else{
	$de="DELETE FROM em WHERE emp = $pr";
	$re = mysql_query($de, $link_id)or die(mysql_error());
	unlink($g);

	}

Link to comment
https://forums.phpfreaks.com/topic/60695-unlink-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.