Re: Best way to sort arrays
- From: floortje <none@xxxxxxxxx>
- Date: Thu, 1 Nov 2007 10:38:04 +0100
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
.
- Follow-Ups:
- Re: Best way to sort arrays
- From: Michael Fesser
- Re: Best way to sort arrays
- References:
- Re: Best way to sort arrays
- From: douggunnoe@xxxxxxxxx
- Re: Best way to sort arrays
- Prev by Date: Re: Googles Apps SAML/SSO decrypt
- Next by Date: Re: Quick terminology question
- Previous by thread: Re: Best way to sort arrays
- Next by thread: Re: Best way to sort arrays
- Index(es):