Home > Backend Development > PHP Tutorial > PHP batch deletion of data_PHP tutorial

PHP batch deletion of data_PHP tutorial

WBOY
Release: 2016-07-21 15:57:33
Original
1659 people have browsed it

There is nothing mysterious about the technique of batch deleting articles. I just wanted to write it down and share it with everyone. (Suitable for beginners:)
1. First, on the article list page (list.php), name the multi-select box: "$del_id[]", and the value is the article ID number.
For example (list.php):


$result=mysql_query( "select * from news");
while($rs=mysql_fetch_array($result)){
?>

                                          >

2. Processing page (del.php):
if($del_id!=""){
$del_num=count ($del_id);
for($i=0;$i<$del_num;$i++){
mysql_query("Delete from news where id='$del_id[$i]'");
                                                                                                                                                                                                                                     🎜>          echo("
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template