query("SHOW TABLES LIKE 'user_settings'"); if ($table_check && $table_check->num_rows > 0) { // Save to database $sql = "INSERT INTO user_settings (user_id, theme_color, font_size, updated_at) VALUES (?, ?, ?, NOW()) ON DUPLICATE KEY UPDATE theme_color = VALUES(theme_color), font_size = VALUES(font_size), updated_at = NOW()"; $stmt = $conn->prepare($sql); $stmt->bind_param("iss", $_SESSION['user_id'], $theme_color, $font_size); $stmt->execute(); } } catch (Exception $e) { // Just save to session if DB fails } $success = "Theme settings saved successfully!"; } $page_title = 'Theme Settings'; require_once __DIR__ . '/includes/header.php'; ?>