I have a drop.php file that deletes info from my 2 tables and works fine.
But I need it to delete the files that are with $table 2
I've done some testing and I keep getting the same error everytime can't find the file name.
<?
include('connection.php');
if (isset($_GET['drop'])){
$drop = $_GET['drop'];
} else {
$drop = 'id';
}
$query = "DELETE $table, $table2 FROM $table LEFT JOIN $table2 ON $table.id = $table2.loc_id WHERE $table.id = $drop";
#$result = mysql_query($query);
$pic_dir = "/var/www/goodlife/pictures/";
$filename = "$table2.url_file = $drop";
$dirpic = $picdir.$filename;
unlink($dirpic);
$result = mysql_query($query);
echo "Removed Location from Database";
mysql_close();
?>
I know my code for unlink is wrong. As I've just been trying different things and seeing if I can get it to work.
In table2 have the colums id url_filename and loc_id.
url_filename works with another file that uploads pictures. it shows the url of the file that is being uploaded so that I can do a img src where all the loc_id = $value.
But I want to be able to delete the files related to the drop so they don't use up space on my server.
My add_pics.php file adds a timestamp to each file so that I don't get the same files uploaded thats why I want to have it delete the files related to the drop.
Any ideas? Thoughts?
TIA
Sean