<?php
set_time_limit(9999999);
$b=explode(",",str_replace(" ","",$_GET['boxes']));
$i=1;
foreach($b as $box){
	if(strlen($box)>=1 && $box!="" && $box!=" ")$boxy[]=$box;
}
for($i=1;$i<=count($boxy);$i++){
	$z="update ecmpricebooks_ecmproducts set position='".$i."' where deleted='0' and ecmproduct_id='".$boxy[$i-1]."' and ecmpricebook_id='".$_REQUEST['record']."'";
	if($GLOBALS['db']->query($z))$ok=1;
	else $error="Error";
}
if($error)print $error;
else print "Saved";
exit;
?>
