<?php
header('Content-Type: application/json');

require_once 'config.php';

// First check connection
if ($conn->connect_error) {
    die(json_encode(['error' => 'Connection failed: ' . $conn->connect_error]));
}

echo json_encode([
    'connection' => 'OK',
    'databases_query' => $conn->query("SHOW TABLES")->num_rows . ' tables'
], JSON_PRETTY_PRINT);
?>
