title: bootstrap navigation in php mysql
body: <p>I had previous navigation tree, as shown below:</p>
  
  <pre><code>&lt;?php               
            $main=mysql_query("SELECT * FROM mainmenu WHERE aktif='Y'");
  
            while($r=mysql_fetch_array($main)){
               echo "&lt;li&gt;&lt;a href='$r[link]'&gt;&lt;span&gt;$r[nama_menu]&lt;/span&gt;&lt;/a&gt;";
               $sub=mysql_query("SELECT * FROM submenu, mainmenu  
                          WHERE submenu.id_main=mainmenu.id_main 
                          AND submenu.id_main=$r[id_main] AND submenu.id_submain=0 AND submenu.aktif='Y'");
             $jml=mysql_num_rows($sub);
              // if submenu found                
              if ($jml &gt; 0){
                echo "&lt;div&gt;&lt;ul&gt;";                 
                  while($w=mysql_fetch_array($sub)){
                  echo "&lt;li&gt;&lt;a href='$w[link_sub]' class='parent'&gt;&lt;span&gt;&amp;#187; $w[nama_sub]&lt;/span&gt;&lt;/a&gt;";
                        $sub2 = mysql_query("SELECT * FROM submenu WHERE id_submain=$w[id_sub] AND id_submain!=0");
                  $jml2=mysql_num_rows($sub2);
                  if ($jml2 &gt; 0){
                                echo "&lt;div&gt;&lt;ul&gt;";
                           while($s=mysql_fetch_array($sub2)){
                              echo "&lt;li&gt;&lt;a href='$s[link_sub]'&gt;&amp;#187; $s[nama_sub]&lt;/a&gt;&lt;/li&gt;";
                           }
                          echo "&lt;/ul&gt;&lt;/div&gt;&lt;/li&gt;";
                        }
                  }           
  
               echo "&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;
                     &lt;/li&gt;";
              }
              else{
                echo "&lt;/li&gt;";
              }
            }        
          ?&gt;
  </code></pre>
  
  <p>then I also have a database, as follows:</p>
  
  <p><a href="http://pastebin.com/hgqeU7Na" rel="nofollow">SQL</a></p>
  
  <p>How to convert the navigation tree into bootstrap?
  thank in advance</p>