<?php
require_once __DIR__ . '/config/database.php';

function sendError($message, $code = 500) {
    echo "ERROR: $message\n";
    exit;
}

$db = getDb();
$res = $db->query("SHOW TABLES LIKE 'cart_items'");
if ($res->num_rows > 0) {
    echo "SUCCESS: Table 'cart_items' found.\n";
} else {
    echo "FAILURE: Table 'cart_items' NOT found.\n";
}

$res = $db->query("SHOW TABLES LIKE 'orders'");
if ($res->num_rows > 0) {
    echo "SUCCESS: Table 'orders' found.\n";
} else {
    echo "FAILURE: Table 'orders' NOT found.\n";
}

$res = $db->query("SHOW TABLES LIKE 'order_items'");
if ($res->num_rows > 0) {
    echo "SUCCESS: Table 'order_items' found.\n";
} else {
    echo "FAILURE: Table 'order_items' NOT found.\n";
}
