RE: [PHP] paging through results of mysql query
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:[EMAIL PROTECTED]] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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
[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) Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php