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
<?php
$login="blablabla";
$pass="passpasspass";
$server="localhost";
$bbdd="my_database_name";
$db=mysql_connect($server,$login,$pass);
mysql_select_db($bbdd,$db);
$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> ";//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


