<?php
$database = 'my_db';
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";
}
}
}
}