So Im trying to create this tabbing system that pulls some categories from a wordpress setup, and then puts the categories in each new tab (got that down ok), and then pull the data from the table with the posts and display that according to each tab. So for example NOTE: [x] = active (Tab 1 [x]) | (Tab 2) | (Tab 3) ====================== Title 1 in category tab 1 Title 2 in category tab 1 Title 3 in category tab 1 (Tab 1) | (Tab 2 [x]) | (Tab 3) ====================== Title 1 in category tab 2 Title 2 in category tab 2 Title 3 in category tab 2 and so on... I think you get it from there. So my code seems to be working alright except for one thing. As the titles are being pulled, they are display 'across' so to speak, instead of 'down' So it looks like this (Tab 1 [x]) | (Tab 2) | (Tab 3) ====================== Title 1 in category tab 1 (Tab 1 ) | (Tab 2 [x]) | (Tab 3) ====================== Title 2 in category tab 1 (Tab 1 ) | (Tab 2) | (Tab 3 [x]) ====================== Title 3 in category tab 1 Soo - I know it's my loops and I know they are wrong - I just can't see where it's at! I've tried to rework this code 3 times now... Here's my present code and any adjustments are appreciated! <?php $sql_cats = "SELECT * FROM wp_terms WHERE term_id != '1' AND name != 'Blogroll' ORDER BY name ASC"; $res_cats = mysql_query($sql_cats); $num = mysql_num_rows($res_cats); $i = 1; while ($i <= $num){ while($row_cats = mysql_fetch_array($res_cats)){ $categories = $row_cats['name']; $cat_id = $row_cats['term_id']; $sql_cat_id = "SELECT * FROM wp_term_relationships WHERE term_taxonomy_id = '{$cat_id}'"; $res_cat_id = mysql_query($sql_cat_id); while($row_catID = mysql_fetch_array($res_cat_id)){ $post_id = $row_catID['object_id']; $sql = "SELECT * FROM wp_posts WHERE ID = '{$post_id}'"; $res = mysql_query($sql); while($row = mysql_fetch_assoc($res)){ $id = $row['ID']; $post_title = $row['post_title']; echo '<div id="fragment-' . $i . '">' . $post_title . ' - ' . $id . '<br></div>'; $i++; } } } } ?> PHP:
Pull down your primary data - then map it together using an associative array, then you can iterate over the mapped data
yeah I fixed it told you i needed some fresh eyes. After walking away for quite a while and coming back - it then dawned on me. The 'div' tag itself needed to come out side of that loop. The content within it could loop just the divs had to be moved! All is good now