Zelaron Gaming Forum

Zelaron Gaming Forum (http://zelaron.com/forum/index.php)
-   Tech Help (http://zelaron.com/forum/forumdisplay.php?f=329)
-   -   php - Breaking Pages of Data (http://zelaron.com/forum/showthread.php?t=47420)

Goodlookinguy 2008-11-03 04:41 PM

[AWW]
 
e-FUCKING-RASED : Damn it, I shouldn't let other people use my accounts. I know php damn it.

WetWired 2008-11-03 10:09 PM

There is a limit clause to SQL queries that you can use if you're worried about efficiency. Obviously, you can use a count query to get the total number without the overhead of actually retreiving all of them.

Goodlookinguy 2008-11-04 07:43 PM

Quote:

Originally Posted by WetWired (Post 658858)
There is a limit clause to SQL queries that you can use if you're worried about efficiency. Obviously, you can use a count query to get the total number without the overhead of actually retrieving all of them.


I know all about the LIMIT clause, but I've had a rather hard time coming up with a method of breaking them up properly.

I believe it's a for statement I'm trying to do, but I'm failing to figure it out. Maybe, I can try to look at existing data and keep breaking it up from there. Hmm...maybe. Wait, no, I don't have it. AH!

WetWired 2008-11-04 08:02 PM

get the count of total results
number of pages=intval((total+perpage-1)/perpage)
check that requested page is >0 and <=number of pages
query the results LIMIT perpage*(pagenum-1),perpage
post results
display pagenav with pages 1 to number of pages


All times are GMT -6. The time now is 05:35 AM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.