I’m a beginner and trying to do a dynamic menu on my website. created a database with xammp.now it seems that there is a connection, because it showed some errors before.but now it doesn’t show errors but also doesn’t create the dynamic menu I wanted.The site is built with bootstrap and there are main categories with drop downs to sub-links. it should be populated from the database but it doesn’t show errors but also doesn’t show the menu.
I would be very grateful for your help
Here is the code:
[php]<?php
$sql = “SELECT * FROM categories WHERE parent=0”;
$pquery = $db->query($sql);?>
-
<?php while($parent = mysqli_fetch_assoc($pquery));?>
<?php
$parent_id= $parent['id'];
$sql2 = "SELECT * FROM categories WHERE parent='parent_id'";
$cquery = $db->query($sql2); ?>
-
<?php echo $parent['category'];?>
-
<?php while($child = mysqli_fetch_assoc($cquery));?>
- <?php echo $child['category'];?>