<?php
/*********************************************************************************
 * Gest'Ecole is a school management software developped by
 * DOX Conception Copyright (C) 2012-2013 DOX Conception
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the license published by DOX Conception.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY.  See the Software License for more details.
 * 
 * You should have received a copy of the software license along with
 * this program; if not, see:
 * http://www.doxconception.com/index.php/licence-de-gestecole.html
 ********************************************************************************/

$req=mysql_query("SELECT * FROM `accueil_perso` WHERE id_util='".$_SESSION['id_util']."' AND colonne='1' ORDER BY ordre ASC");
for ($i=1;$i<=mysql_num_rows($req);$i++)
{
  $id=mysql_result($req,$i-1,'id');
  $ordre=mysql_result($req,$i-1,'ordre');
  $key=array_search($ordre,$_POST['listItem'])+1;
  $req2=mysql_query("UPDATE `accueil_perso` SET ordre='$key' WHERE id='$id'");
}
?>