many thanks Ray
which bit of the update code do I replace that with
I have
<?php
if (false) {
$UpdateQuery = new WA_MySQLi_Query($DBConnection);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "faqs";
$UpdateQuery->bindColumn("FaqID", "i", "".($Products[0]) ."", "WA_DEFAULT");
$UpdateQuery->bindColumn("FaqOrder", "i", "".($start) ."", "WA_DEFAULT");
$UpdateQuery->addFilter("FaqID", "=", "i", "".($_GET['FaqID']) ."");
$UpdateQuery->execute();
$UpdateGoTo = "";
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo?rel2abs($UpdateGoTo,dirname(__FILE__)):"";
$UpdateQuery->redirect($UpdateGoTo);
}
?>
and updated the original code to this but it doesnt reorder the content
<?php
function cmp($a, $b) {
return ($a[2] < $b[2] || ($a[2] == $b[2] && $b[2] == $b[1]))? -1: 1;
}
if (isset($_POST["UpdateOrder"])) {
$OrderArray = array();
$start = 1;
while (isset($_POST["FaqID_".$start])) {
$OrderArray["Products_". $_POST["FaqID_".$start]] = array($_POST["FaqID_".$start],$start,$_POST["FaqOrder_".$start]);
$start ++;
}
$start = 1;
uasort($OrderArray, "cmp");
foreach ($OrderArray as $Products) {
$UpdateQuery = new WA_MySQLi_Query($DBConnection);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "faqs";
$UpdateQuery->bindColumn("FaqID", "i", "".($Products[0]) ."", "WA_DEFAULT");
$UpdateQuery->bindColumn("FaqOrder", "i", "".($start) ."", "WA_DEFAULT");
$UpdateQuery->addFilter("FaqID", "=", "i", "".($_GET['FaqID']) ."");
$UpdateQuery->execute();
$UpdateGoTo = "";
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo?rel2abs($UpdateGoTo,dirname(__FILE__)):"";
$UpdateQuery->redirect($UpdateGoTo);
}
}
?>