How to use PHP to bulk delete all tables prefixed with prefix_ in the database.
example, uniformly remove the table prefixed with "prefix_".
<?PHP//Sets the database connection information. Database server address, database user name, data passwordmysql_connect(' Database host ', ' Database user name ', ' Database password '); //set the database name for the querymysql_select_db(' Database name '); $rs=mysql_query(' Show Tables '); while($arr=Mysql_fetch_array($rs) ) {www. Jbxue.com//Set the database table prefixes to be deleted in bulk, such as: Prefix_$TF=Strpos($arr[0], ' prefix_ '); if($TF===0){ $FT=mysql_query(The drop table$arr[0] "); if($FT){ Echo"$arr[0] Delete success! <br> "; } } } ?>
Operation Example:
Create a new PHP file and save it as deletedata.php.
For example, to delete www.jbxue.com or http://www.jbxue.com/background data, the operation of two steps is OK:
1. First upload this saved deletedata.php file to your website root directory;
2. Enter directly in the Address bar: www.jbxue.com/deletedata.php or http://www.jbxue.com/deletedata.php execute this delete script.
The script displays information about all table deletion successes in the browser.