Created
April 21, 2009 08:11
-
-
Save itspriddle/99021 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment