Php batch delete tables with the same prefix in MySql database _ PHP Tutorial

Source: Internet
Author: User
Tags mysql tutorial
Php deletes tables with the same prefix in the MySql database in batches. Php Tutorial batch delete MySql database tables with the same prefix in tutorial formidform1nameform1methodpostaction? Phpecho $ PHP_SELF ;?? Actionkilltablewidth425border0aligncente php Tutorial batch delete tables with the same prefix in the MySql database tutorial


If (@ $ _ GET ["action"] = "kill "){

If (empty ($ _ POST ['IP'])
Echo "you have not entered an IP address ";
Echo"
";
If (empty ($ _ POST ['user'])
Echo "you have not entered the user name ";
Echo"
";
If (empty ($ _ POST ['pass'])
Echo "you have not entered the password ";
Echo"
";
If (empty ($ _ POST ['DB'])
Echo "you have not entered the database ";
Echo"
";
If (empty ($ _ POST ['qz'])
Echo "you have not entered the prefix ";
Echo"
";

$ Ip = $ _ POST ['IP'];
$ User = $ _ POST ['user'];
$ Pass = $ _ POST ['pass'];
$ Db = $ _ POST ['DB'];
$ Qz = $ _ POST ['qz'];

$ Conn = mysql tutorial _ connect ($ ip, $ user, $ pass );
If (! $ Conn ){
Die ("database connection error! Www.zhutiai.com ");
}
Mysql_connect ($ ip, $ user, $ pass );

Mysql_select_db ($ db );

$ Rs = mysql_query ('Show tables ');

While ($ arr = mysql_fetch_array ($ rs )){

$ TF = strpos ($ arr [0], $ qz );

If ($ TF = 0 ){

$ FT = mysql_query ("drop table $ arr [0]");

If ($ FT ){

Echo "$ arr [0] deleted successfully!
";
}

}

}

}

?>

Batch delete tables with the same prefix in the MySql database tutorial form id = form1 name = form1 method = post action =? Php echo $ PHP_SELF ;?? Action = kill table width = 425 border = 0 align = cente...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.