This doesn't seem to work, but I am hoping it is close:
<?php
// query database to find file names
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
$myFile = $row['loc'];
$myFile2 = 'pathtofolder/';
$result = $myFile2 . $myFile;
if( !file_exists($result) ) {
unlink($result);
}
}
?>
I get the error "mysql_fetch_array() expects parameter 1 to be resource, string given"