gabael
-
Posts
2 -
Joined
-
Last visited
Posts posted by gabael
-
-
Hi guys.
I'm strunggling with one mysql query. Please help. The situation is following:
I have 2 tables:
+========= MENUS ===========+
| ID | menu_name | menu_link |
| 21 | home | home.php |
| 22 | products | products.php |
| 23 | about | about.php |
+============================+
+============== SUBMENUS ==============+
| ID | menus_id | submenu_name | submenu_link |
| 1 | 22 | product 1 | product-1.php |
| 2 | 22 | product 2 | product-2.php |
| 3 | 23 | contacts | contactas.php |
+=======================================+
my URL looks like www.domain.com/product-1.php?id=1
based on ID value from URL product-1.php?id=1 I need to display the Product 1 and Product 2
I tried something like this:
"SELECT menus.id, submenus.* FROM menus, submenus WHERE menus.id=submenus.menus_id"
but it gives me of course back everything from submenus.
How can I reduce result to show me only product 1 and product 2 based on ID from URL ????
Thanks for any help.
Select value from table and use it as another value from same table.
in MySQL Help
Posted · Edited by gabael
id 1 from URL is relating to submenus id 1.
I need to grab that ID somehow transfrom it to value-> menus_id and than do some query WHERE menus.id = submenus.menus_id.
Is this possible to do ???