<?php
// debug-update-settings.php
// Enable direct access for debug
if (!defined('ALLOW_DIRECT_ACCESS')) {
    define('ALLOW_DIRECT_ACCESS', true);
}

ini_set('display_errors', 1);
error_reporting(E_ALL);

require_once __DIR__ . '/config.php'; // pastikan path config.php sudah benar

try {
    // Contoh: update setting
    $settingKey = 'marquee_text';
    $settingValue = 'Tes debug update';
    $stmt = $db->prepare("UPDATE website_settings SET setting_value = ? WHERE setting_key = ?");
    $result = $stmt->execute([$settingValue, $settingKey]);

    if ($result) {
        echo "Update berhasil.<br>";
    } else {
        echo "Update gagal.<br>";
    }

    // Tampilkan error info dari PDO
    $errorInfo = $stmt->errorInfo();
    echo "PDO Error Info: <pre>";
    print_r($errorInfo);
    echo "</pre>";

} catch (Exception $e) {
    echo "Exception: " . $e->getMessage();
}
?>
