Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
<?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"; } } } }
This paste will be private.
From the Design Piracy series on my blog: