There aren't many fast ways around it.
The method I provided is the exact vBulletin uses to update the order of forums in the Admin Cp:
PHP Code:
// ###################### Start do order #######################
if ($_POST['do'] == 'doorder')
{
globalize($_POST, array('order'));
if (is_array($order))
{
$forums = $DB_site->query("SELECT forumid,displayorder FROM " . TABLE_PREFIX . "forum");
while ($forum = $DB_site->fetch_array($forums))
{
$displayorder = intval($order["$forum[forumid]"]);
if ($forum['displayorder'] != $displayorder)
{
$DB_site->query("
UPDATE " . TABLE_PREFIX . "forum
SET displayorder = $displayorder
WHERE forumid = $forum[forumid]
");
}
}
}
build_forum_permissions();
define('CP_REDIRECT', 'forum.php?do=modify');
print_stop_message('saved_display_order_successfully');
}
The only main difference is this:
PHP Code:
$displayorder = intval($order["$forum[forumid]"]);
if ($forum['displayorder'] != $displayorder)
Which is a check to ensure that it's not quering and updating a row when it has yet to be modified.
You could probably apply the same to the code above.