<?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['updateArray']) && !empty($_POST['updateArray'])) {
		$i = 1;
		foreach ($_POST['updateArray'] as $index => $id) {

			$sql = "UPDATE formData
					SET orderNum = '".$index."'
					WHERE recordKey = '".mysql_real_escape_string($id)."'";
			mysql_query($sql) or die(mysql_error());
			$i++;
		}
		die('1');
	}
}

die('0');
?>