|
Posted by Jerry Stuckle on 10/10/39 11:57
version2 wrote:
> Does any know where a good change order for navigation script or
> tutorial is?
>
> Cause this is what i want to accomplish.
>
> thanks
>
OK, now what you're trying to do makes a lot more sense.
I think the easiest way to do this would be a combination of PHP and
SQL. You can do it all in SQL depending on the release, but this should
work with all releases.
Let's say your table contains, among other things:
id rank
1 10
2 20
3 30
4 40
5 50
And you want to swap 3 and 4.
You can add 15 t0 #3, as you indicated:
id rank
1 10
2 20
3 45
4 40
5 50
Now, to get them in the order:
id rank
1 10
2 20
4 30
3 40
5 50
$rank = 10;
$result1 = mysql_query('SELECT id, rank FROM mytable ORDER BY rank');
while ($data = mysql_fetch_result($result1)) {
$result2 = mysql_query("UPDATE mytable SET rank=$rank WHERE id =
{$data['id']});
$rank += 10;
}
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|