Home > Backend Development > PHP Tutorial > 怎么把对应信息下的所有图片全部删除?小弟我的代码只删除一张图片。

怎么把对应信息下的所有图片全部删除?小弟我的代码只删除一张图片。

WBOY
Release: 2016-06-13 10:27:06
Original
837 people have browsed it

如何把对应信息下的所有图片全部删除?我的代码只删除一张图片。。。
代码运行后只删除文件夹里的一张图片,怎么做到把对应信息下的图片全部删除呢?



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;
?>

------解决方案--------------------
都是你自己的方法。只有你自己知道。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template