Hey all,
I'm new to the boards, well new to posting usually I can find a solution by just searching. I am trying to make a function that will delete a file based on an ID that has been passed to it.
I have a database with records and there are 2 fields that are the names of a picture in a folder. If I delete the record I want to also delete the pictures that correspond to it. I attempted to do the following.
function deleteRecord($mid) {
$sql_snap1 = "SELECT snap1 FROM records WHERE rid='$mid'";
$sql_snap2 = "SELECT snap2 FROM records WHERE rid='$mid'";
$snap1 = mysql_query($sql_snap1);
$snap2 = mysql_query($sql_snap2);
chdir("../records");
unlink($snap1);
unlink($snap2);
$sql_rec = "DELETE FROM records WHERE mid=$mid";
$result_rec = mysql_query($sql_rec);
}
The problem is I get this error.
Warning: unlink(): No such file or directory in /home/clanmka/public_html/devel/records_func.php on line 58
Warning: unlink(): No such file or directory in /home/clanmka/public_html/devel/records_func.php on line 59
Can someone please help me figure out how to resolve this! Also all permissions on the folders are set correctly.
Thanks