会员登陆
帐号:

密码:

记住我



忘记密码?

现在注册!
网站导航
Mysql批量删除具有相同表前缀的数据表
44 次阅读
Tag: php   mysql   技巧  

简单好用,废话少说,看代码. 

<?php
mysql_connect('host','username','password');
mysql_select_db('');
$rs=mysql_query('show tables');

while($arr=mysql_fetch_array($rs)){
    $TF=strpos($arr[0],'class_');
    if($TF===0){
        $FT=mysql_query("drop table $arr[0]");
        if($FT){
            echo "$arr[0] 删除成功!<br>";
            }
        }
    }
?>