mikemastah Posted January 14, 2009 Posted January 14, 2009 I'm looking for a way to divide my member list into pages 25 users each (Pages: 1 2 3 4 5....) I've been studying mccodes (V1) to see how they do this but I just don't get it. I also did a search on google, I read you need a for-loop but I'm not really good with for-loops either..... If someone could point me in the right direction, that would be awesome. Quote
AlabamaHit Posted January 14, 2009 Posted January 14, 2009 Re: Member-list I think their is a limit already.............100 or something like that... Just change the LIMIT 100 to LIMIT 25..... Quote
mikemastah Posted January 15, 2009 Author Posted January 15, 2009 Re: Member-list @SomeRandomBastard: very clear tutorioal thanks :) @AlabamaHit I don't use mccodes, I just studied their code to see how they did it. The thing is mccodes v1 is really bad arranged(or something else I don't know the word for it, opposite of well-arranged;). Quote
Floydian Posted January 15, 2009 Posted January 15, 2009 Re: Member-list Pagination is the name most people give that sort of thing. It doesn't necessarily require a loop per say. If you retrieve all records, you will have to loop through a segment of them instead of the whole thing. Since you're probably getting the data from the db, you're most likely already doing a loop anyways. Where the pagination comes in is not going through the entire record set. You could get part of the record set by putting a limit clause on your query. It's not the easiest thing to do though when you haven't done one before. There are API's out there specifically for pagination though. ;) Quote
AlabamaHit Posted January 15, 2009 Posted January 15, 2009 Re: Member-list Thats what i was saying was use limit..... I didn't say you was using mccodes...you did....or at least mentioned it so i though you was. $sql_1 = mysql_query("SELECT username FROM users LIMIT 25"); $sql_2 = mysql_query("SELECT username FROM users LIMIT 25,25"); Maybe something along that lines. Quote
POG1 Posted January 15, 2009 Posted January 15, 2009 Re: Member-list $sql_2 = mysql_query("SELECT username FROM users LIMIT 25,25"); wouldn't that return 1 record? Quote
Floydian Posted January 16, 2009 Posted January 16, 2009 Re: Member-list That would return 25 records starting from the 25th position, i.e., page 2 Quote
AlabamaHit Posted January 16, 2009 Posted January 16, 2009 Re: Member-list Yup what Floydian said :-D lol he beat me back :-P Quote
POG1 Posted January 16, 2009 Posted January 16, 2009 Re: Member-list i made a mistake i get it. The first number is the start and the second number is how many records to get, i thought it was between the numbers. Quote
Lithium Posted January 16, 2009 Posted January 16, 2009 Re: Member-list i made a mistake i get it. The first number is the start and the second number is how many records to get, i thought it was between the numbers. as of "intervals" sql does have specific calls for those "BETWEEN" or even interval() just in case you need to use them ;) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.