<?php
include 'includes/db.php';
$schema = [];

$res = $conn->query("DESCRIBE blogs");
if ($res) {
    while ($row = $res->fetch_assoc()) {
        $schema['blogs'][] = $row;
    }
} else {
    $schema['blogs_error'] = $conn->error;
}

$res = $conn->query("DESCRIBE services");
if ($res) {
    while ($row = $res->fetch_assoc()) {
        $schema['services'][] = $row;
    }
} else {
    $schema['services_error'] = $conn->error;
}

header('Content-Type: application/json');
echo json_encode($schema, JSON_PRETTY_PRINT);
?>
