There is connection to database but it doesn't show the data on the webpage

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);?>

Kippah store
[/php]

Several issues really,

[php]$sql = “SELECT * FROM categories WHERE parent=0”;[/php]
It isn’t likely that you have a 0 id, unless you manually added it.

[php]$sql2 = “SELECT * FROM categories WHERE parent=‘parent_id’”;[/php]
Won’t work because I doubt you have “parent_id” in the parent column.

[php]while($child = mysqli_fetch_assoc($cquery));[/php]
Those semicolons at the end of the while loop terminate it before it ever begins.

Sponsor our Newsletter | Privacy Policy | Terms of Service