Menu Template included in every page????

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
User avatar
Joan Garnet
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars

Thu Nov 21, 2002 3:54 am

Well, I think it goes like this:
You have your mysql table called menu with id and name_menu of menu.
Then you have another table called submenus with id, id_menu (which corresponds whith the id of the menu above) and the name_submenu of the submenu.

Then to output this data you gotta make a query like this:

Code: Select all

$sql="select * from submenu where id_menu = '$my_var'";//$my_var is the $HTTP_GET_VARS corresponding with the id of the menu clicked by the user
$result = mysql_query ($sql,$db);
while ($row = mysql_fetch_array ($result)) {
   echo "<a href='".$row["name_submenu"].".php'>".$row["name_submenu"]."</a>&nbsp;&nbsp;";//this will output as many links as submenus has the clicked menu, and each link will take you to a page called sub_menu_name.php

Maybe I talked too much...
You just gotta swallow it now

Post Reply