Do you want it done permanently for all users?
if so something along the lines of
PHP Code:
$q = $db->query('select * from forums order by title');
$i = 0;
while($row = $db->fetch_array($q))
{
$i++;
$db->query("UPDATE forum SET order = $i WHERE forumid = $row[forumid]");
}
rebuilt_forums_cache();
UNTESTED and is only meant to serve as an example. It will need some work to get it to work correctly