38443-vm/test_reorder.php
Flatlogic Bot b5ae307f55 categories
2026-02-15 23:38:38 +00:00

18 lines
686 B
PHP

<?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";
}
?>