How to implement the delete function
In the main page of the background, we find theModify/Deletebutton pattern under the operation column as shown below. In this chapter, we will first talk about how to implement the function of deleting a piece of data.
The main idea of realizing the deletion function is to obtain theidof the data that needs to be deleted, and delete this through SQL statements Book id to delete all records of this id in the database table.
First create adelete.phpfile
Get it inlist.phpThe path of id is then deleted. Make the following modifications in list.php,$rows["id"]is output through the while loop in the previous section.
delete.php file, import the database public file config.php, get the value of the id and delete this data in the database. Write the following code:
alert('删除成功');window.location.href='list.php'"; }else{ echo ""; } ?>