mikemastah Posted January 14, 2009 Share 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 Link to comment Share on other sites More sharing options...
AlabamaHit Posted January 14, 2009 Share 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 Link to comment Share on other sites More sharing options...
mikemastah Posted January 15, 2009 Author Share 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 Link to comment Share on other sites More sharing options...
Floydian Posted January 15, 2009 Share 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 Link to comment Share on other sites More sharing options...
AlabamaHit Posted January 15, 2009 Share 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 Link to comment Share on other sites More sharing options...
POG1 Posted January 15, 2009 Share 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 Link to comment Share on other sites More sharing options...
Floydian Posted January 16, 2009 Share Posted January 16, 2009 Re: Member-list That would return 25 records starting from the 25th position, i.e., page 2 Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted January 16, 2009 Share Posted January 16, 2009 Re: Member-list Yup what Floydian said :-D lol he beat me back :-P Quote Link to comment Share on other sites More sharing options...
POG1 Posted January 16, 2009 Share 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 Link to comment Share on other sites More sharing options...
Lithium Posted January 16, 2009 Share 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 Link to comment Share on other sites More sharing options...
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.