RE: [PHP] paging through results of mysql query

From: Date: Thu, 05 Dec 2002 17:47:27 +0000
Subject: RE: [PHP] paging through results of mysql query
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-127178@lists.php.net to get a copy of this message
> 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...

« previous php.general (#127178) next »