title: Responsive multi level dynamic menu php mysql
body: <p>I have made dynamic menu using mysql php. Everything is working fine on the desktop. But the issue is that it adds dropdown-menu class to every ul because of which the submenu will become non clickable as it tries to open other submenu because of dropdown class. Here is my code. Please check it on both mobile version and desktop version.</p>
  
  <p>Database Table:</p>
  
  <pre><code>CREATE TABLE `tbl_menu` (
  `id` int(10) UNSIGNED NOT NULL,
  `label` varchar(200) NOT NULL DEFAULT '',
  `link` varchar(100) NOT NULL DEFAULT '',
  `parent` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `sort` int(10) UNSIGNED NOT NULL DEFAULT '0'
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  
  INSERT INTO `tbl_menu` (`id`, `label`, `link`, `parent`, `sort`) VALUES
  (1, 'Home', 'index.php', 0, 1),
  (2, 'Offer Store', '#', 0, 2),
  (3, 'Adidas', 'coupon_brand_store.php?id=20&amp;page=1', 2, 3),
  (4, 'Deal Store', '#', 0, 7),
  (5, 'Nike', 'deal_brand_store.php?id=20&amp;page=1', 4, 8),
  (6, 'Mcd', 'coupon_brand_store.php?id=22&amp;page=1', 2, 4),
  (7, 'ON', 'coupon_brand_store.php?id=19&amp;page=1', 2, 5),
  (8, 'Walmart', 'coupon_brand_store.php?id=25&amp;page=1', 2, 6),
  (9, 'Tacos', 'deal_brand_store.php?id=21&amp;page=1', 4, 9),
  (10, 'Herblife', 'deal_brand_store.php?id=22&amp;page=1', 4, 10),
  (11, 'GAS', 'deal_brand_store.php?id=19&amp;page=1', 4, 11),
  (12, 'Offers Store', '#', 0, 12),
  (13, 'PUMA', 'ecommerce.php?id=19&amp;page=1', 12, 13),
  (14, 'REEBOK', 'ecommerce.php?id=20&amp;page=1', 12, 14),
  (15, 'All Stores', 'allstores.php', 0, 15),
  (17, 'All Coupons', 'coupons.php', 0, 16),
  (18, 'All Deals', 'exclusive.php', 0, 17); 
  </code></pre>
  
  <p>This is the PHP code to print the navigation menu:</p>
  
  <pre><code>function get_menu_tree($parent_id) 
  {
  global $con;
  $menu = "";
  $sqlquery = " SELECT * FROM tbl_menu where parent='" .$parent_id . "' order 
  by sort";
  $res=mysqli_query($con,$sqlquery);
  while($row=mysqli_fetch_array($res,MYSQLI_ASSOC)) 
  {
         $menu .="&lt;li &gt;&lt;a href='".$row['link']."'&gt;".$row['label']."&lt;/a&gt;";
  
         $menu .= "&lt;ul class='dropdown-menu'&gt;".get_menu_tree($row['id'])." 
  &lt;/ul&gt;"; //call  recursively
  
         $menu .= "&lt;/li&gt;";
  
  }
  
  return $menu;
  } 
  
  ?&gt;
  &lt;div id="main-menu" class="wa-main-menu main-menu"&gt;
  &lt;!-- Menu --&gt;
  &lt;div class="wathemes-menu relative"&gt;
  &lt;!-- navbar --&gt;
  &lt;div class="navbar navbar-default theme-bg mar0" role="navigation"&gt;
  &lt;div class="container"&gt;
  &lt;div class="row"&gt;
  &lt;div class="col-md-12 col-sm-12 col-xs-12"&gt;
  &lt;div class="navbar-header"&gt;
  &lt;!-- Button For Responsive toggle --&gt;
  &lt;button type="button" class="navbar-toggle" data-toggle="collapse" data- 
  target=".navbar-collapse"&gt;
  &lt;span class="sr-only"&gt;Toggle navigation&lt;/span&gt;
  &lt;span class="icon-bar"&gt;&lt;/span&gt;
  &lt;span class="icon-bar"&gt;&lt;/span&gt;
  &lt;span class="icon-bar"&gt;&lt;/span&gt;
  &lt;/button&gt;
  
  &lt;/div&gt;
  &lt;!-- Navbar Collapse --&gt;
  &lt;div class="navbar-collapse collapse"&gt;
  &lt;div class="row"&gt;
  &lt;ul class="nav navbar-nav"&gt;
  &lt;?php echo get_menu_tree(0);//start from root menus having parent id 0 ?&gt;
  &lt;/ul&gt; 
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And if i remove the dropdown clas from the ul the dropdown menu stops working.</p>