I'm working on a project and have run into something that for my current level of PHP knowledge, would take me a while to figure out. If you can offer any help/tips it would be much appreciated <img src="http://www.ubbdev.com/forum/images/graemlins/smile.gif" alt="" /><br /><br />Current related code:<br /><br />[]<br />$cats = array(1,2); <br />unset($cats); <br />$mice = array(1=>array(1,2));<br />unset($mice[0]); <br />unset($mice[1]);<br /><br />// Gather the needed FAQs<br />$result = mysql_query("SELECT uid,title FROM faq WHERE (is_private = 0 AND approved_date_time = '0000-00-00 00:00:00') || (is_private = 1 AND author_uid = " . $rid . ");");<br />for ($i = 0; $i < mysql_num_rows($result); $i++) {<br /> list($uid,$title) = mysql_fetch_row($result);<br /> $cats[$uid] = $title;<br />}<br /><br />// For each FAQ that was gathered above, get the category_tree_uid<br />foreach($cats as $key => $value) {<br /> $khalif = mysql_query("SELECT category_tree_uid FROM faq_category WHERE faq_uid = " . $key . ";");<br /> if(mysql_num_rows($khalif)) {<br /> for ($i = 0; $i < mysql_num_rows($khalif); $i++) {<br /> list($category_tree_uid) = mysql_fetch_row($khalif);<br /><br /> // See if the reseller is subscribed to this category<br /> $res = mysql_query("SELECT user_uid FROM user_sub WHERE user_uid = " . $rid . " AND category_tree_uid = " . $category_tree_uid . ";");<br /> if(mysql_num_rows($res)) {<br /> $mice[$category_tree_uid][$key] = $value;<br /> }<br /> } <br /> }<br />}<br /><br />$fight = array(1,2);<br />unset($fight);<br />foreach($mice as $key => $value) {<br /> $vizier = mysql_query("SELECT name FROM category_tree WHERE uid = " . $key . ";");<br /> list($category) = mysql_fetch_row($vizier);<br />?><br /><h2><?=$category?></h2><br /><?<br /> $fight = $value;<br /> foreach($value as $keys => $values) {<br /> $linkme = $keys;<br /> $title = $values;<br /> ?><br /> <a href="display-faq-detail.php?id=<?=$linkme?>"><?=$title?></a><br><br /> <?<br />}<br />}<br />[/] <br /><br />Pseudocode I've come up with:<br /><br /> [] <br />// For each FAQ - We need to load these types of information into array(s)<br /><br />category_name <- name of the FAQ's parent category<br />category_tree_uid <- id number for the FAQ's parent category<br />key <- id number for the specific FAQ<br />title <- title of the FAQ<br /><br />// Need to sort individual FAQs by category_name, regardless of it's category_tree_uid<br /><br />// Need to output each FAQ:<br />// Display the category_name only once for each group of FAQs with identical category_name<br />// Print link/title<br /> [/] <br /><br />Main things are getting the info into arrays, sorting while keeping related data for each FAQ grouped, cycling through array to print out info.<br /><br />Thanks again for any help. <img src="http://www.ubbdev.com/forum/images/graemlins/smile.gif" alt="" />