<?php
session_start();
if (!isset($_SESSION['FirstName'])) {
	exit;
}
include ('includes/db1config.php');
include ('../includes/mysql_connect.php');
$i = 0;
//clear all first
 $qry="UPDATE productCategory SET orderNum = $i WHERE recordKey = $value";
  mysql_query($qry);
  $i++;
foreach ($_POST['cat'] as $value) {
    // Execute statement:
     $qry="UPDATE productCategory SET orderNum = $i WHERE recordKey = $value";
	 //save qry to test log for troubleshooting
	 $query="insert into test_log (field1, field2) values ('update category_order','$qry') ";
	 mysql_query($query);
	 mysql_query($qry);
    $i++;
}

?>