set_charset('utf8mb4'); echo "KONEKSI: BERHASIL!\n"; echo "Host: " . DB_HOST . "\n"; echo "Database: " . DB_NAME . "\n"; echo "User: " . DB_USER . "\n\n"; echo "=== CEK TABEL ===\n"; $tables = ['users', 'spbu', 'rumah_ibadah', 'penduduk_miskin']; $tableExists = []; foreach ($tables as $table) { $result = $conn->query("SHOW TABLES LIKE '$table'"); $exists = $result->num_rows > 0; $tableExists[$table] = $exists; echo "Tabel '$table': " . ($exists ? "ADA" : "TIDAK ADA") . "\n"; } echo "\n=== CEK USER ADMIN ===\n"; if (!$tableExists['users']) { echo "Tabel users belum ada. Jalankan: php scripts/init_db.php\n"; } else { $result = $conn->query("SELECT username, created_at FROM users LIMIT 5"); if ($result && $result->num_rows > 0) { while ($row = $result->fetch_assoc()) { echo "User: " . $row['username'] . " | Dibuat: " . $row['created_at'] . "\n"; } } else { echo "Tabel users kosong - belum ada user!\n"; } } } catch (mysqli_sql_exception $e) { echo "KONEKSI GAGAL!\n"; echo "Error: " . $e->getMessage() . "\n"; echo "Host dicoba: " . DB_HOST . "\n"; }