<?php
session_start();
// Simulate admin session for testing
$_SESSION['admin_id'] = 1;

require 'config.php';

echo "<h2>Testing Admin Users API</h2>";
echo "<pre>";

// Test the query
$sql = "SELECT id, name, email, phone, address, created_at, status FROM users LIMIT 5";
echo "SQL Query: $sql\n";
echo "---\n";

$result = $conn->query($sql);

if (!$result) {
    echo "Database Error: " . $conn->error . "\n";
} else {
    echo "Query successful!\n";
    echo "Number of rows: " . $result->num_rows . "\n";
    echo "\nData:\n";
    
    while ($row = $result->fetch_assoc()) {
        echo json_encode($row, JSON_PRETTY_PRINT) . "\n";
    }
}

echo "</pre>";

$conn->close();
?>
