<?php
// Script to drop corrupted tables in ci_news database
$host = 'localhost';
$user = 'root';
$pass = ''; // Default XAMPP/WAMP
$db   = 'ci_news';

$conn = new mysqli($host, $user, $pass, $db);

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$tables = ['pendidikan', 'aktivitas', 'biodata', 'migrations', 'news'];

echo "Dropping corrupted tables...\n";

foreach ($tables as $table) {
    if ($conn->query("DROP TABLE IF EXISTS `$table`")) {
        echo "Successfully dropped or confirmed non-existence of table: $table\n";
    } else {
        echo "Error dropping table $table: " . $conn->error . "\n";
    }
}

$conn->close();
echo "Done.\n";
