Skip to content
Advertisement

How can i create dynamic menu with sub-menu with php & mysql?

I’m trying to create an dynamic menu from mysql table with php but i don’t know how to create the non category menu, here is what i have so far and is working only the categories with submenus but the non categories ones they are not shown on echo.

MySQL category menu Table:

JavaScript

MySQL sub menus Table:

JavaScript

My Php code:

JavaScript

Advertisement

Answer

Instead of a Left Join, wich leaves out the unpaired records in your category table, try a Full Join

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement