Sudden change in structure

I am working on the menu page of a restaurant website. The structure was like this:


[LIST]
[*]Soup
[*]Appetizers
[LIST]
[*][*]Salads
[*][*]Hot Appetizers
[/LIST]
[*]Main Courses
[LIST]
[*][*]Fish
[*][*]Meat
[*][*]Poultry
[/LIST]
[*]Side Dishes
[*]Menus
[/LIST]

and a link would look like this:

<a href="modules/site/menu.php?category_id=1&amp;group_id=1">Soup</a>

As you can see from the anchor were the results based on two id’s category_id and group_id. Clicking the link soup would result in a listing of the soups they serve, and obviously the same for the other links like salads, meat, fish, menus etc. To achieve that I used the following query and output on the result page:


<?php
    $category_id = filter_input(INPUT_GET, 'category_id', FILTER_SANITIZE_NUMBER_INT);
    $group_id    = filter_input(INPUT_GET, 'group_id', FILTER_SANITIZE_NUMBER_INT);

    $qryMenu = "SELECT MG.menu_group_id, MG.menu_group, MI.menu_item, MI.description_dut, MI.description_eng, MI.description_dut2, MI.description_eng2, MI.description_dut3, MI.description_eng3, MI.description, MI.price 
                FROM menu_groups MG 
                INNER JOIN menu_items MI
                ON MG.menu_group_id = MI.menu_group_id
                WHERE menu_category_id = $category_id
		AND MG.menu_group_id = $group_id";
									 
      if ($result = $mysqli->query($qryMenu)) {
          while ($row = $result->fetch_assoc()) {
                   echo "<h1>{$row['menu_group']}</h1>
                         <dl>
                           <dt>{$row['menu_item']}<span>";if ($row['price'] == "Dagprijs"){}else{echo"&#8364;";}echo"&nbsp;{$row['price']}</span></dt>
                         </dl>";
          }
      }
?>

But suddenly the owner of the website would like to show the different 4 and 5 course dinners not longer as a listing but as separate items just like salads and Hot Appetizers under Appetizers and Fish, Meat and Poultry under Main Courses. Changing the database is/was not an option so I thought that including the id of each menu_item could do the trick so I changed the structure in the menu


[LIST]
[*]Menus
[LIST]
[*][*]Menu Canton
[*][*]Menu Szechuan
[*][*]Pekingeend Szechuan
[*][*]etc
[/LIST]
[/LIST]

and in the anchor I added menu_id

<li><a href="modules/site/menu.php?category_id=4&amp;group_id=9[B]&amp;menu_id=79[/B]">Menu Canton</a></li>

and added the following to the result page:


$menu_id     = filter_input(INPUT_GET, 'menu_id', FILTER_SANITIZE_NUMBER_INT);

if ($menu_id ) {
    $qryMenu .= "AND menu_item_id = $menu_id";
}

but that isn’t working at all as you can see here when you click on one of the first four menus under menus (Theater Menu is coming from a different group). What should I adjust to make it work?

Thank you in advance!

Not sure if I understand your situation. Do you need to associate some items on the menu with a 4/5 course dinner option?

If so you would need a column in the database to make that association. Whats the issue with changing the database structure??

[ot]Hi donboe,
I see the short/long pages suffer from [U]theJumpingPage.htm[/U], for instance when changing between the “Soepen” page and the “Voorgerechten” page on a 1280*1024px screen.[/ot]
It seems there is also something wrong in the calling of the pages.
In the menu the “Soepen” page has a link to <a href=“modules/site/menu.php?category_id=1&group_id=1”>
and the “Salades” page has a link to <a href=“modules/site/menu.php?category_id=2&group_id=2” class=“subitem”>,
though for both the address in the browser bar is staying at “cantonamsterdam.nl/canton-menu.php”. While it is php-driven, I can’t see why.

Isn’t it the easiest way to make all pages separate pages, with a php-include for the menu and other permanent parts of the page?
Then for all changes afterwards you only have to adapt the menu-include. :slight_smile: