{% else-1 %}
Велосипед, может кому пригодиться , в скрипте загруз центра или форума *

                        
<?php

/*
CREATE TABLE IF NOT EXISTS `test` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`pos` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;

INSERT INTO `test` (`id`, `name`, `pos`) VALUES
(1, 'test1', 1),
(2, 'test2', 2),
(3, 'test3', 3),
(4, 'test4', 4),
(5, 'test5', 5),
(6, 'test6', 6),
(7, 'test7', 7);
*/

include 'config.php';

$dbtable = 'test';

$pg = $_SERVER['PHP_SELF'];

$row = mysql_query("SELECT * FROM `test` ORDER BY `pos` ASC");
$x = 0;
$kol = mysql_num_rows($row);
while($list=mysql_fetch_row($row)) {
$x++;
echo '<div>' . $list[0] . ' -- ' . $list[1] . '<br/>';
if ($x!=1) {
echo '<a href="' . $pg . '?posid=' . $x . '&amp;up">вверх</a> | ';
} else {
echo 'вверх | ';
}
if ($x!=$kol) {
echo '<a href="' . $pg . '?posid=' . $x . '&amp;down">вниз</a>';
} else {
echo 'вниз';
}
$arrsort[$x] = $list[0] . '|' . $list[2];
echo '</div>';
}

$posid = isset($_GET['posid']) ? $_GET['posid'] : '';

if (isset($_GET['up'])) {
$vp = $arrsort[$posid];
$ind = $posid-1;
$vr = $arrsort[$ind];
$varpos = explode("|", $vp);
$varrep = explode("|", $vr);
mysql_query("UPDATE " . $dbtable . " SET `pos`='" . $varrep[1] . "' WHERE `id`='" . $varpos[0] . "'");
mysql_query("UPDATE " . $dbtable . " SET `pos`='" . $varpos[1] . "' WHERE `id`='" . $varrep[0] . "'");
header("Location: " . $pg . "");
exit;
}
if (isset($_GET['down'])) {
$vp = $arrsort[$posid];
$ind = $posid+1;
$vr = $arrsort[$ind];
$varpos = explode("|", $vp);
$varrep = explode("|", $vr);
mysql_query("UPDATE " . $dbtable . " SET `pos`='" . $varrep[1] . "' WHERE `id`='" . $varpos[0] . "'");
mysql_query("UPDATE " . $dbtable . " SET `pos`='" . $varpos[1] . "' WHERE `id`='" . $varrep[0] . "'");
header("Location: " . $pg . "");
exit;
}

#print_r($arrsort);
?>
0 44 0
Без комментариев...