[Freerealty] Bug fix release
Scott Wang
scott at scottscomputing.com
Thu May 12 09:08:06 MST 2005
I applied the image deletion code from the latest admin.php but I'm still
having problems with images not being deleted when I delete a listing. I'm
using the "folders" option.
However, if I delete an image from a listing (without deleting the listing),
it works just fine! So I compared the code used to delete a single image
with the code used to delete images during the deletion of a listing, and I
can't find where the problem is! The only difference is that deleting an
image uses $deleteimage to define which image, and the image deletion along
with the listing uses $delete to define which image, but that should be ok.
The other difference is that the image deletion that goes along with a
listing uses a while() function while the single image deletion doesn't.
Any ideas?
//code after the listing has been deleted
print "Listing #$delete has been removed...";
if (isset($images_use) && $images_use == "folders" )
{
//Get the image information....
$sql = "select id_files, filename from ".$table_prefix."tbl_Files where
id_files = $delete ";
$image_query = mysql_query($sql, $link);
while ($image_result = mysql_fetch_array($image_query))
{
unlink
("$install_path/$imageloc/listings/$image_result[id_files]"."_"."$image_resu
lt[filename]");
unlink
("$install_path/$imageloc/listings/$image_result[id_files]"."_"."thumb"."_".
"$image_result[filename]");
}
}
$query = "DELETE FROM ".$table_prefix."tbl_Files WHERE (prop_num =
'$delete')";
if (!mysql_query ($query, $link) )
{
die (mysql_error());
}
print "Images for property #$delete have also been removed...";
}
//DELETE AN IMAGE
if (isset($deleteimage) && $deleteimage != "")
{
if (isset($images_use) && $images_use == "folders" )
{
//Get the image information....
$sql = "select id_files, filename from ".$table_prefix."tbl_Files where
id_files = $deleteimage ";
$image_query = mysql_query($sql, $link);
$image_result = mysql_fetch_array($image_query);
unlink
("$install_path/$imageloc/listings/$image_result[id_files]"."_"."$image_resu
lt[filename]");
unlink
("$install_path/$imageloc/listings/$image_result[id_files]"."_"."thumb"."_".
"$image_result[filename]");
}
$query = "DELETE FROM ".$table_prefix."tbl_Files WHERE (id_files =
$deleteimage)";
if (!mysql_query ($query, $link) )
{
die (mysql_error());
}
print "$image_row[filename] has been removed...";
}
- Scott Wang
Scott's Computing
P.O. Box 472 Thorp, WI 54771
Office: 715-669-5412 Fax: 715-669-5413
Email: scott at scottscomputing.com
More information about the FreeRealty
mailing list