What function can I use to compare the name listed in a DB row, to a filename listed in a directory?
IE, the row is named picture. The picture in question might be named bad_dog.gif when it was uploaded. I added it to the database field 'picture' when uploaded. Now, upon deletion, I want to clear that image out of the directory. If it's named 'bad_dog.gif' in that row, then I need to find 'bad_dog.gif' in directory 'inventory' (or perhaps multiple directories).
if ($HTTP_POST_VARS[Submit]) { // if user submitted, then delete product from inventory
$query = "SELECT picture FROM products WHERE product_id=$pid";
$result = mysql_query ($query);
//$file = $row[0];
while ($row = mysql_fetch_array($result)) {
//print "Value stored at that position is $row[0]<BR>";
if (file_exists($file_dir)) {
//unlink("$file");
echo $result;
print "File DIR"; }
if (file_exists($thumbs_dir)) {
//unlink("$file");
echo $userfile_name;
print "Thumbs DIR"; }
else { echo "Nothing"; }
}