彭和平垃圾回收机制

WBOY
Release: 2016-06-23 14:39:08
Original
1023 people have browsed it

有一个功能:
删除某些内容后,能够恢复原有的内容。这是什么原理?
是不是可以把你想删除的东西存放到另一个表里面。
然后如果你想恢复的话从另一个表里面把它在更新下?

$sql="delete from `#@__skupdate_class` where id=".$id."";	$bool = $dsql->ExecuteNoneQuery($sql);	if(!$bool)	{        ShowMsg("课程信息回收站删除失败",'-1');        exit();    }else{		ShowMsg("课程信息回收站删除成功",'update_class.php?dopost=recycling&page='.$page.'');        exit();	}
Copy after login

$sql="Update `#@__skupdate_class` set state=1 where id=".$id."";	$bool = $dsql->ExecuteNoneQuery($sql);	if(!$bool)	{        ShowMsg("课程信息恢复失败",'-1');        exit();    }else{		ShowMsg("课程信息恢复成功",'update_class.php?dopost=recycling&page='.$page.'');        exit();	}
Copy after login

这是几个意思明明已经删除了啊?
delete from `#@__skupdate_class` where id=".$id."
Copy after login

求解


回复讨论(解决方案)

好像明白了。我在这里少写了代码了!!

$sql="Update `#@__skupdate_class` set state=2 where id=".$id."";	$bool = $dsql->ExecuteNoneQuery($sql);	if(!$bool)	{        ShowMsg("课程信息删除失败",'-1');        exit();    }else{		ShowMsg("课程信息删除成功",'update_class.php?page='.$page.'');        exit();	}
Copy after login

其实就是更新到别的地方了。然后还原的时候在根据state把它还原回来。。搞定了  。不浪费大神们时间了 。。。。以后我看清楚了再发!

数据表定义status字段 0表示删除,1表示启用
当你新增数据的时候 status的状态为1,当你删除的时候status的状态为0
恢复数据,直接更改status状态属性即可。

数据表定义status字段 0表示删除,1表示启用
当你新增数据的时候 status的状态为1,当你删除的时候status的状态为0
恢复数据,直接更改status状态属性即可。
恩。我在想你头像的问题。。
哈哈

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!