#!/usr/bin/php -q Can only run this script from the CLI
\n"); } // -- local config -- @include('db.php'); @include('equipment_db.php'); $db = mysql_select_db($database_name, $connection); if (!$db) { die("Could not select database:\n" . mysql_error() . "\n"); } // -- destroy tables -- $t = 0; do { $new_table = $tables[$t]; if (!isset($new_table)) { break; } $query = "SELECT * FROM {$new_table[0]}"; $result = mysql_query($query); if (!$result) { echo "table {$new_table[0]} does not exist:\n" . mysql_error() . "\n"; } else { $query = "DROP TABLE {$new_table[0]}"; $result = mysql_query($query); if (!$result) { die("Could not drop table {$new_table[0]}:\n" . mysql_error() . "\n"); } echo "table {$new_table[0]} deleted:\n" . mysql_error() . "\n"; } $t++; } while (true); // -- destroy db -- if (1) { $query = "DROP DATABASE {$database_name}"; $result = mysql_query($query); if (!$result) { die("Could not drop db:\n" . mysql_error() . "\n"); } } // ---- return(0); ?>