Crius

mysql 批量删除表

<?php
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);
?>

 

分类:

技术点:

相关文章:

  • 2021-06-04
  • 2021-11-30
  • 2021-11-30
  • 2021-11-30
  • 2021-08-13
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
猜你喜欢
  • 2021-11-05
  • 2021-11-30
  • 2021-11-30
  • 2021-11-30
  • 2021-11-30
  • 2021-11-30
  • 2021-11-30
相关资源
相似解决方案