|
Posted by Sandman on 03/13/06 21:28
In article <1142276108.908369.290380@z34g2000cwc.googlegroups.com>,
"comp.lang.php" <phillip.s.powell@gmail.com> wrote:
> jonathan.beckett wrote:
> > Don't do it. You'll kill the webserver. It's also just an incredibly
> > bad way of doing it.
> >
>
> Why? Wouldn't hitting the database hundreds of times be even worse?
>
> > You should be forming queries that limit the resultset and provide the
> > results on demand.
> >
> > With MySQL you can do something like...
> >
> > SELECT foo FROM bar LIMIT x,y
> >
> > ... where x and y are the start record, and number of records to grab.
>
> Yeah but the customer demands that they be able to do this:
>
> 1) Sort all of the existing records by multiple fields
> 2) Search all existing records according to a fulltext field
> 3) Be able to view Page 127 or 40 or 3 or whatever entirely on the fly
> WHILE looking at the paginated 10 - 20 records that they are able to
> see upfront.
All of which you handle with a db query, not by saving db query
results.
select * from db order by date desc, headline limit 127,40
Will show all and sort by date field first, descending, and headline
next, ascending. And will begin at result number 127 and show 40
results.
PIece of cake. What you mean by "WHILE looking at the paginated 10-20
records" I don't know, but opening another result in a new window, or
in a frame or in a DIV isn't very hard.
--
Sandman[.net]
Navigation:
[Reply to this message]
|