<?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 extras SET priority = " . $listingcounter . " WHERE insert_id = " . $idvalue);
	
	$listingcounter = $listingcounter + 1;	
	}
}
?>