<?php
session_start();
if (!isset($_SESSION['FirstName'])) {
	exit;
}

include ('includes/db1config.php');
include ('../includes/mysql_connect.php');

  
if (isset($_POST) && !empty($_POST)) {
	if (isset($_POST['items_order']) && !empty($_POST['items_order'])) {
		$i = 1;
		foreach ($_POST['items_order'] as $itemId) {
			$sql = "UPDATE products
					SET orderNum = '".$i."'
					WHERE itemKey = '".mysql_real_escape_string($itemId)."'";
			mysql_query($sql) or die(mysql_error());
			$i++;
		}
		die('1');
	}
}

die('0');
?>