<div class="artitle" data-id=1>lorem</div>
<div class="artitle" data-id=2>ipsum</div>
//and so on - about 500 divs
using javascript I reordered the divs up and down and need to save this new order in database(column ind).
let ids = $.map($('.artitle'), (e) => $(e).data('id')).join(',');
let inds = $.map($('.artitle'), (e) => $(e).index()).join(',');
//$.post... - send the variables on remote server
php
$aids = explode(',', $ids);
$ainds = explode(',', $inds);
foreach($aids as $key=>$val){
    $sql = "update arts set ind = :aind where id = :aid";
    $st = $db->prepare($sql);
    $st->execute([
        ":aind" => $ainds[$key],
        ":aid" => $val
    ]);
}
It works but is there a better way - to avoid repeating sql query 500 times?
 
    