<?php 
require_once "connect.php";

$action = $mysqli->real_escape_string($_POST['action']); 
$updatelistarray = $_POST['listarray'];

if ($action == "updatelisting"){
	
	$listingcounter = 1;
	foreach ($updatelistarray as $idvalue) {
		
	$mysqli->query("UPDATE lang SET priority = " . $listingcounter . " WHERE id = " . $idvalue);
	
	$listingcounter = $listingcounter + 1;	
	}
}
?>