Gossamer Forum
Quote Reply
Sorting
I have searched the archives and found http://www.gossamer-threads.com/perl/forum/showflat.pl?Cat=&Board=L2Cust&Number=107477&page=0&view=collapsed&sb=5

This works for me when I have links sorted by votes, rating and hits (i.e. "$sortby{$i} = join ("", @unsorted[$db_votes + $offset, $db_rating + $offset, $db_hits + $offset]);"

However, if I try and amend this to also sort by isnew (i.e. "$sortby{$i} = join ("", @unsorted[$db_votes + $offset, $db_rating + $offset, $db_isnew + $offest, $db_hits + $offset]);"

then the sorting seems to go to pot.

The higher voted links still appear at the top of the listing, but within links that have the same number of votes they are not sorted by rating or number of hits, and links that have zero votes and ratings are not sorted by hits as they are when isnew is not used as a sort criteria.

Could it be that the first example uses only numeric fields (voting, rating and hits) which, when the alpha field isnew is included causes things to go wrong?

Any pointers much appreciated.