RE: [PHP] paging through results of mysql query
| From: | Larry Brown | Date: | Thu, 05 Dec 2002 19:40:52 +0000 |
| Subject: | RE: [PHP] paging through results of mysql query | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-127190@lists.php.net to get a copy of this message | ||
Much Gratefulness on my part! Finally, my server and I can catch our
breath.
Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388
-----Original Message-----
From: John W. Holmes [mailto:holmes072000@charter.net]
Sent: Thursday, December 05, 2002 12:47 PM
To: 'Larry Brown'; 'PHP List'
Subject: RE: [PHP] paging through results of mysql query
> I know I'm trying to re-invent the wheel, but it is because I don't
know
> how
> they do it. I set up a script to pull a ruleset from mysql and then
loop
> through each row in the set. I then check each row as it loops until
I
> get
> to the row number I want and start echoing rows. I create the row
numbers
> by a $m=0; outside the loop; $m++; inside the loop. Then I stop
echoing
> rows when it reaches 50 iterations. The total iterations achieved is
> passed
> on to the next script that does the same thing but starting where the
> total
> left off. This causes a lot of overhead as all of the resultset are
> pulled
> for each script. Does anyone have a magic bullet for this? This
> functionality is what I take search engines to be demonstrating. If
> anyone
> can help, I could wipe the sweat of my processors brow! (and mine for
> that
> matter)
SELECT * FROM tbl WHERE ... LIMIT $start, $per_page;
Adjust $start and $per_page accordingly to get your "paging"...
---John Holmes...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php