<?php
require 'db/config.php';
$orders = [
    ['id' => 1, 'position' => 1, 'category_id' => null],
    ['id' => 10, 'position' => 0, 'category_id' => null],
    ['id' => 6, 'position' => 2, 'category_id' => null],
    ['id' => 2, 'position' => 3, 'category_id' => null],
    ['id' => 9, 'position' => 4, 'category_id' => null],
    ['id' => 3, 'position' => 5, 'category_id' => null]
];
$server_id = 1;
$stmt = db()->prepare("UPDATE channels SET position = ?, category_id = ? WHERE id = ? AND server_id = ?");
foreach ($orders as $o) {
    $stmt->execute([$o['position'], $o['category_id'], $o['id'], $server_id]);
    echo "Updated ID {$o['id']} to position {$o['position']}\n";
}
?>
