Jump to content

Deleting Files


lpxxfaintxx

Recommended Posts

This is how I do both.....remove from the db and delecte the file from the directory...

[code]
$id=$_GET['id'];

// Retrieve all the data from the table
$result = mysql_query("SELECT * FROM uploads WHERE id='$id'")
or die(mysql_error());

// store the record of the table into $row
$row = mysql_fetch_array( $result );

$myFile = "upload_files/$row[userfile]";
unlink($myFile);


$query = "DELETE FROM uploads WHERE id='$id'";
$result = mysql_query($query);
[/code]
Link to comment
https://forums.phpfreaks.com/topic/6220-deleting-files/#findComment-22472
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.