mysql 批量删除表
时间:2021-07-01 10:21:17
帮助过:3人阅读
set_time_limit(0
);
$con =
mysql_connect("localhost", "user", "pwd"
);
$dbname = "db"
;
if (
$con) {
if (
mysql_select_db(
$dbname,
$con)) {
$sql = "SHOW TABLES WHERE Tables_in_
$dbname LIKE ‘prd_%‘;"
;
$ret =
mysql_query(
$sql);
while(
$row =
mysql_fetch_assoc(
$ret)){
$info1[] =
$row["Tables_in_
$dbname"
];
}
foreach (
$info1 as $val) {
//表名字$val
$sql ="drop table
$val"
;
mysql_query(
$sql);
}
}
}
mysql_close(
$con);
?>
mysql 批量删除表
标签:tables show tab for [] logs local code sel