<?php
require_once 'includes/config.php';
require_once 'includes/db.php';

try {
    // Update category images
    $updates = [
        ['Electronics', 'assets/images/categories/electronics.jpg'],
        ['Clothing', 'assets/images/categories/Clothing.jpg'],
        ['Sports', 'assets/images/categories/Sports.jpg'],
        ['Home & Garden', 'assets/images/categories/home_garden.jpg'],
        ['Books', 'assets/images/categories/books.jpg']
    ];
    
    foreach ($updates as $update) {
        $stmt = $pdo->prepare("UPDATE products SET category_image = ? WHERE category = ?");
        $stmt->execute([$update[1], $update[0]]);
        echo "Updated category: " . $update[0] . " with image: " . $update[1] . "\n";
    }
    
    echo "All category images updated successfully!\n";
} catch (Exception $e) {
    echo "Error updating category images: " . $e->getMessage() . "\n";
}
?>