一般情况下分为两种情况:
1:逻辑删除,只把那一条记录的状态改变,表示已经删除。(推荐学习:php视频教程)
2:记录删除,直接把这一条记录删除。(有的还直接把文件也删除)
$sql="select * from new ";$res=mysql_query($sql);$all=array();while($row=mysql_fetch_assoc($res)){$all[]=$row;//读取new数据表 所有数据}html 页面<?phpforeach($all as $rows)//循环所有数据到页面?><tr><td><?php echo $rows['title'];?></td><td><?php echo $rows['content'];?></td><td><a href='xxx.php?act=del&title=<?php echo $rows['title'];?>>删除</a></td></tr><?php}?>xxx.phpif(isset($_get['act'])&&$_get['act']=='del')//删除{$title=$_get['title'];mysql_query("delete from new where title='".$title."' ");//删除sql语句}
以上就是php如何删除数据的详细内容。
