Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I would personally nest the second for loop (which I have changed to while loops) in the firsts (and this is very much rough code) but notice in the parent loop the has been removed from the section title.:</p> <p>Some pseudo code:</p> <pre><code>print parent unordered list start get section data loop through section results print parent list item start print section title get page data print unordered child list start loop through page results print child list item start print page info print child list item end print child unordered list end print parent list item end print parent unordered list end </code></pre> <p>And from pseudo code to something close to your code:</p> <pre><code>$sql="SELECT * FROM section ORDER BY orderID"; $result=mysql_query($sql) or die ("Error!! BAD SELECT SEARCH STATEMENT"); // Top level Items while($row = mysql_fetch_array($result){ extract($row); if ($section == "FORUM") echo"&lt;li&gt;&lt;a href='#' rel='dropmenu$i'&gt;$section&lt;/a&gt;"; else echo"&lt;li&gt;&lt;a href='#h' rel='dropmenu$i'&gt;$section&lt;/a&gt;"; $sql3="SELECT * FROM category WHERE sectionid='$sectionid'"; $pageResult=mysql_query($sql3) or die ("Error!! BAD SELECT SEARCH STATEMENT"); echo "&lt;ul&gt;"; while($page = mysql_fetch_array($pageResult){ extract($page); //process and print each child &lt;li&gt;...&lt;/li&gt; here //(this is a cut down example) where you would add your if/elseif section echo "&lt;li&gt;$title&lt;/li&gt;"; } echo "&lt;/ul&gt;"; //close child UL echo "&lt;/li&gt;"; //close parent LI } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload