Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php // drop wp_ tables

// Set to your db
$database = 'my_db';

// Add your user/pass
if ( ! mysql_connect('localhost', 'username', 'password'))
{
  die("Couldn't connect to db.  MySQL Error (".mysql_errno()."): ".mysql_error());
}

$res = mysql_query("SHOW TABLES FROM {$database}");

if (mysql_num_rows($res) > 0)
{
  while ($r = mysql_fetch_array($res))
  {
    $table = $r['Tables_in_'.$database];
    if (substr($table, 0, 3) == 'wp_')
    {
      if (mysql_query("DROP TABLE {$table}"))
      {
        echo "Deleted {$table}\n";
      }
      else
      {
        echo "Couldn't delete {$table}\n";
      }
    }
  }
}