Home > Article > Backend Development > PHP mysql data batch deletion code_PHP tutorial
We usually obtain the data submitted by the form. If we use checkbox[] to operate below, see an example below.
-->
if( $_post )
{
print_r( $_post );
//Input is also saved in the form of data,
/*
array
(
[checkbox] => array
(
[0] => 1
[1] => 2
[2] => 3
)
[button] => Submit
)
This is easy to operate, we only need to do the following
*/
$array = $_post['checkbox'];
print_r( $array );
/*
The content obtained is as follows
array
(
[0] => 1
[1] => 2
[2] => 3
)
In fact, 1, 2, and 3 are what we want, and we can use sql's in to delete them in batches.
*/
$ids = implode(',',$array );
$sql ="delete from table name where id in($ids ) ";
mysql tutorial_query($sql);
//This will achieve batch deletion of data.
// Please indicate the source of original reprints on this site: http://www.bKjia.c0m Otherwise, we will investigate!
}