php tutorial batch delete tables with the same prefix in MySql database tutorial
if(@$_GET["action"]=="kill"){
if (empty($_POST['ip']))
echo "You did not fill in the IP address";
echo "
";
if (empty($_POST['user']))
echo "You did not fill in the username";
echo "
";
if (empty($_POST['pass']))
echo "You did not fill in the password";
echo "
";
if (empty($_POST['db']))
echo "You did not fill in the database";
echo "
";
if (empty($_POST['qz']))
echo "You did not fill in 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!
";
}}
}
}
?>