This query takes a lot of time to run when the id_array is big. How can I make it faster? Is it maybe possible to do this in one query instead of multiple updates as in my example?
<?php
$sort = 1;
$id_array = array(
56,
14,
99,
54,
8,
92
);
foreach ($id_array as $id) {
mysqli_query($conn, "UPDATE id_table SET sort = '$sort' WHERE id = '$id'");
$sort++;
}
?>