Hi all, I'm rather puzzled over this, tried a few things but nothing ever 
worked satisfactorily.
I've got an sql database with a table 'sideblocks' that represents objects 
on a webpage. More specifically blocks of text/links that appear at either 
side of the page. A column in that table is a place number called 'pos' 
which represents the position of the block on the page, i.e if pos = 1 then 
it's at the top, pos = 2 is underneath it, etc.
I have to write a web based tool that enables you to move blocks up and down 
amongst themselves. But I'm stumped over a method. Everything I've tried so 
far either messed up all the position numbers, or didn't work at all.
Basically, the web form provides a box to type in a position number, and 
when it's submitted, it sends the perl script into a routine that goes 
through the database re-arranging all the position numbers. So if block 5 
was selected for editting, and was told to go to position 2, when the script 
runs through the database, 1 stays where it is, the current 2 is moved to 3 
and 5 is placed in position 2, then 3 is moved to 4, and 4 is moved to 5. In 
reverse, if 1 was told to go to position 4, 2 would move up to 1, 3 would 
move to 2, 4 would move to 3, the old 1 would be put in position 4, and 5 
would remain unchanged.
At some points I've managed to master moving blocks up from bottom to top, 
but not the other way around as well!
Does anyone have any hints or tips on the best way to go about this? I'm 
currently scratching my head real hard now to a point where I think I'm 
losing hair!
Many thanks,
Dan 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to