Re: arrays() current() next() who to use
| From: | Torsten Roehr | Date: | Thu, 19 Aug 2004 22:06:14 +0000 |
| Subject: | Re: arrays() current() next() who to use | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-194291@lists.php.net to get a copy of this message | ||
"Vern" <vernon@comp-wiz.com> wrote in message
news:20040819203202.35302.qmail@pb1.pair.com...
> Problem with that is it sorts according the results of the recordset
range.
>
> For instance:
>
> It will show the user 1 trhough 10 sorted by miles then 20 - 30 sorted by
> miles, however, in 1 through 10 could have a range of 0 to 1000 miles and
> the next set will have 5 to 200 miles. What I need is to sort them all by
> miles first. The only way I know to do that is to do the way I set it up.
So
> if I create an array, sort that array by the miles then use that array.
> However the array is different that the recordset and thus does not use
> LIMIT.
What about this:
SELECT * FROM table ORDER BY miles LIMIT 0, 10
Then pass the offset to your query function and exchange it with 0:
SELECT * FROM table ORDER BY miles LIMIT $offset, 10
Of course you have to properly validate that $offset is an integer before
using it in the query.
Regards, Torsten Roehr