fix koneksi database admin
This commit is contained in:
+12
-6
@@ -39,20 +39,26 @@ try {
|
||||
|
||||
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";
|
||||
$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";
|
||||
}
|
||||
if (!$tableExists['users']) {
|
||||
echo "Tabel users belum ada. Jalankan: php scripts/init_db.php\n";
|
||||
} else {
|
||||
echo "Tabel users kosong - belum ada user!\n";
|
||||
$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) {
|
||||
|
||||
Reference in New Issue
Block a user