elhama Posted August 11, 2006 Share Posted August 11, 2006 Alright, Didn't get any good responds yesterday so I try again, my thread kinda died..So the problem is now that I have to limit the data to a max of 25 per page, which is simple by itself, but also what I have to do is to keep it categorized, and I just can't seem to get through with it, can someone enlighten me please?Here is some example code I've tried to fix, but it keeps messing up! The loops gets screwed up.. Here's what I want to getCategory 1- Comment 1- Comment 2Category 2- Comment 1- Comment 2Note: This is only testing/example code of what I'm meaningCode:[code]<b><?echo "<table border=1>";if(!isset($_GET['page'])){ $numPage = 1;}else{ $numPage = $_GET['page'];}$rowsPerPage = 2;$offset = ($numPage - 1) * $rowsPerPage;$testy = mysql_fetch_array(mysql_query("SELECT category FROM myfriends limit $offset, 1"));$test = mysql_query("SELECT * FROM myfriends limit $offset, $rowsPerPage");$category=$testy[category];while(($category < 5) && ($t = mysql_fetch_array($test))){ if($category==1) $cat_text = "Friends"; if($category==2) $cat_text = "Family"; if($category==3) $cat_text = "School"; if($category==4) $cat_text = "The Rest"; echo "<tr><td>$cat_text</td></tr>"; $test3 = mysql_query("SELECT * FROM myfriends where category='$category' limit $offset, $rowsPerPage") or die(mysql_error()); while($e = mysql_fetch_array($test3)){ echo "<tr><td>$e[comment]</td></tr>"; }$category = $category+1;}echo "</table>";$topage = $numPage +1;echo "<a href=test.php?page=$topage>></a>";?></b>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/17189-paging-multicategory/ Share on other sites More sharing options...
elhama Posted August 11, 2006 Author Share Posted August 11, 2006 bump Quote Link to comment https://forums.phpfreaks.com/topic/17189-paging-multicategory/#findComment-72819 Share on other sites More sharing options...
corbin Posted August 11, 2006 Share Posted August 11, 2006 I would try to help you, but what youre sayin makes no sense at all... Quote Link to comment https://forums.phpfreaks.com/topic/17189-paging-multicategory/#findComment-72824 Share on other sites More sharing options...
Lessur Posted August 11, 2006 Share Posted August 11, 2006 Is whast you want is like an outline?I. Category 1 A. Comment 1 B. Comment 2II. Catergory 2 A. Comment 1 B. Comment 2? Quote Link to comment https://forums.phpfreaks.com/topic/17189-paging-multicategory/#findComment-72827 Share on other sites More sharing options...
elhama Posted August 11, 2006 Author Share Posted August 11, 2006 Yes lessur, thats exactly what I'm trying to do... Quote Link to comment https://forums.phpfreaks.com/topic/17189-paging-multicategory/#findComment-72829 Share on other sites More sharing options...
sasa Posted August 11, 2006 Share Posted August 11, 2006 what you wont?1st page cat1 -com1 -com2cat2 -com1next pagecat2 -com2cat3 -com1 -com2or1st pagecat1 -com1cat2 -com1cat3 com1next pagecat1 -com2cat2 -com2cat3 -com2 Quote Link to comment https://forums.phpfreaks.com/topic/17189-paging-multicategory/#findComment-73041 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.