|
Posted by Jochem Maas on 05/03/05 03:22
Graham Anderson wrote:
> Hi
> I am allready using a 'rank' field now... with 1 to N :) There are just
> so damned many of them to order manually
>
> the up/down button solution...is there a tutorial or php class out there
> I could take a look at...
> where you:
> give the class a query...
the up and down links need to include the id of the item your moving
and possibly a direction value (depending on how you set your scripts up)
in order to move something up the list you have to find the item 'above' it
on the list (use sql for this). then you have to take the rank of the found item
and the requested item and swap the id (update with sql)
.... alternatively you can use the fact that a select box can be multi-select
and that the order of the listed items in replicated in the GET/POST (and inside
php) .... i.e. use javscript to allow a user to move items up and down a select box
(drag'n'drop or using up/down buttons), (warning - when your form submits all
the items in the multi-selectlist must be selected, a javascript
can be used for this.) and then on the server use the order of the list returned
from the page to re-order/rank the given users list.
> get a found set back as html with these up/down buttons in each row
> start ordering away with wild abandon....
>
> does this allready exist somewhere ?
>
> g
> On Apr 26, 2005, at 9:59 PM, Richard Lynch wrote:
>
>> On Tue, April 26, 2005 7:05 pm, Graham Anderson said:
>>
>>> lately, I'm finding myself reordering large amounts of rows populated
>>> from a database query ...with an order_id field
>>> this is a bit tedious re-entering every order_id for a found set :(
>>
>>
>> Do different users get to order differently, or is there some "master"
>> order that all shall use?
>>
>> If it's a "master" order, just put a "rank" field on the records, and
>> then
>> make sure it's always 1 to N for the order you want.
>>
>> You can create "up" and "down" buttons to alter the order fairly easily.
>>
>> If each user gets to have their own order, then you're looking at a
>> playlist for each user, so I'd have a different table with just "ID" and
>> "rank" (and userID) in it and do the same sort of thing.
>>
>> --
>> Like Music?
>> http://l-i-e.com/artists.htm
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
Navigation:
[Reply to this message]
|