Baseball Posted December 25, 2009 Share Posted December 25, 2009 $sql2 = "SELECT f.*, c.id as cat_name, c.position as cat_position, c.name as cat_name, mr.icon FROM (forum_sub_cats f, forum_cats c) LEFT JOIN users mr ON (mr.id=f.lpid) WHERE c.id=f.cid ORDER BY f.cid"; $res2 = mysql_query($sql2) or die(mysql_error()); while($row3 = mysql_fetch_assoc($res2)){ echo $row3['cat_name']; echo " <a href=\".?act=forum&fid=".$row3['id']."\">".$row3['name']."</a><br>\n"; echo " " . $row3['desc'] . "\n Posts: "; echo " </div>\n"; } Ok this spit's out: But i dont want it to spit out the category Name for every row, only ONCE Time each .. Category is "24-7GT" But it spits it out 3times, only need that category once.. and the second Category is "Sub Cat #" That spits it out once cause only 1 forum, lol but if i add another forum under that category it will spit "Sub Cat # twice" and I know u might just tell me to just not call it in the while function that's why, but unfortunately iuno any other way, im hoping for u guys to help me so it only spits out the Category one time FOR each forum regardless how many forums i have for each category Thanks and a Merry Christmas to u if u can help ! lol Quote Link to comment https://forums.phpfreaks.com/topic/186345-make-my-christmas-wish/ Share on other sites More sharing options...
Baseball Posted December 26, 2009 Author Share Posted December 26, 2009 Somone please... i am dyig Quote Link to comment https://forums.phpfreaks.com/topic/186345-make-my-christmas-wish/#findComment-984112 Share on other sites More sharing options...
.josh Posted December 26, 2009 Share Posted December 26, 2009 if ($prev_cat_name != $row3['cat_name']) echo $row3['cat_name']; $prev_cat_name = $row3['cat_name']; Quote Link to comment https://forums.phpfreaks.com/topic/186345-make-my-christmas-wish/#findComment-984118 Share on other sites More sharing options...
BahBah Posted December 26, 2009 Share Posted December 26, 2009 nvm, the above does what you want. Quote Link to comment https://forums.phpfreaks.com/topic/186345-make-my-christmas-wish/#findComment-984119 Share on other sites More sharing options...
Baseball Posted December 26, 2009 Author Share Posted December 26, 2009 Wow Merry Christmas to all. Quote Link to comment https://forums.phpfreaks.com/topic/186345-make-my-christmas-wish/#findComment-984127 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.