Get the App
SLTechnology News&Howtos  ›  Development  › 

How to delete table contents in batches by php

Shulou Source: shulou.com Published: 2022-06-03 10:51:37 11月15日 Update

This article will explain in detail how php deletes the contents of the table in batches. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Php batch delete table content method: 1, create a "list_pl.php" file; 2, create "shanchu.php" file to achieve deletion function; 3, create modification and update page; 4, create batch delete page "adminDel.php".

This article operating environment: windows7 system, PHP7.1 version, Dell G3 computer.

Php operation table data [including batch deletion]

Effect picture:

List_pl.php:

Untitled document * {padding:0;margin:0 }. Pd-lr {padding: 5px 20px} Select all: id username and password mailbox operation submission time Delete a total of messages in batch

/ / single delete function confirm_delete (url) {if (confirm ('are you sure you want to delete?')) {_ window.location.href=url;} else {return false }} / / Select all, select $("# checkAll"). On ('change', function () {if ($(this) .is (": checked")) {/ / select all $(".checkOne"). Prop ("checked", true);} else {/ / reverse select $(".checkOne") .prop ("checked", false);}}) / / batch deletion of $('button') .click (function () {var ids=$ ('. CheckOne: checkbox'); var str=''; var count=0; for (var icheck0 switch i0) {for (var imixids.decithmur1polii > = 0) If (ids.eq (I). Is (': checked')) {ids.eq (I). Parent (). Parent (). Remove () } alert ('deleted successfully!') ; _ window.location.reload ();}, error:function (data) {console.log ("data loading failed", data);}})} return false;})

Shanchu.php (you can also enter the path of adminDel.php directly by deleting a single item):

User name:

Tags: Pages data content tables success passwords users usernames articles mailboxes updates items files documents more title reference run good practical Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Shulou Technology Xiaomi Docker Microsoft