You are here: Re: Best way to sort arrays « PHP Programming Language « IT news, forums, messages
Re: Best way to sort arrays

Posted by floortje on 11/01/07 09:38

>
> Could you not cut out the first query? Just in your second query lose
> the 'limit' clause and then when you print "all entries", use the
> $lastentries result. If ordered backwards, start from the last key and
> iterate backwards, I suppose.
>
> And then when you print part 2, just take the first 5.
>
> Other than that, I would go with the 3 queries. Is there a need for it
> to be much faster?

I agree .... there are ways to work around the problem.

I could do something like:

echo 'Last 5 entries';
for ($i=count($allentries),$i>(count($allentries)-5);$i--)
{
echo $allentries[--$i].'<br />';
}

But It still bothers me that I cant simply extract 5 rows that have
largest/smallest value in an array field from a multi dimentional
array. Is there really no better way to do this ?

Floortje

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация