如何把对应信息下的所有图片全部删除?我的代码只删除一张图片。。。
代码运行后只删除文件夹里的一张图片,怎么做到把对应信息下的图片全部删除呢?
include("config.inc.php");
include("function.php");
include("in.php");
if($_COOKIE['fcw_ly']=='企业') header("location:out.php");
$conn=mysql_connect($YIHOST,$YIUSER,$YIPASS);
mysql_query("set names gbk");
mysql_select_db($YINAME);
if (empty($_GET['id']))
{
mysql_close();
echo "<script>alert('非法提交!请重新提交!');history.back();</script>";
exit;
}
$YID=htmlencode2($_GET['id']);
$sql="select YDT,YXT from ytp where YZM=$yimaoid and YLX='房源' and YYH=$YHID and YBH=$YID";
$r=mysql_query($sql);
$row=mysql_fetch_assoc($r);
foreach($row as $v) unlink($v);
$exec="delete from yfy where YZM=$yimaoid and YYH=$YHID and YID=$YID";
mysql_query($exec);
$exec="delete from ytp where YZM=$yimaoid and YLX='房源' and YYH=$YHID and YBH=$YID";
mysql_query($exec);
mysql_close();
echo "<script>alert('删除成功!');history.back();</script>";
exit;
?>
------解决方案--------------------
都是你自己的方法。只有你自己知道。