Codice PHP:
//select * from tabella WHERE id_gara = $id_gara;

$vecchiePosizioni = array();
for (
$rows as $row ) {
  
$id $row['id'];

  
$position $_POST['arrivo_$id'];

  if(
in_array($position$vecchiePosizioni)) //genero errore
  
else {
    
$vecchiePosizioni[] = $position

    
//update tabella set position = $position WHERE id = $id ;

  
}

ps non l'ho testato