stephdowney Posted April 19, 2006 Share Posted April 19, 2006 Hi,i'm designing an online shop and have 2 tables in my database (categories and products) I need to have a menu that lists all categories and then when a categorie is clicked it exapnds to show all th products within that category....any help would be greatthankssteph Quote Link to comment https://forums.phpfreaks.com/topic/7869-help-with-menus/ Share on other sites More sharing options...
Darkness Soul Posted April 19, 2006 Share Posted April 19, 2006 Yo,Hmmm, make a default categorie.. maybe the first found.. and, you will need one page.. with the table, if ALL products of ALL categories are children of the products table.. if some field change.. you may have a layout problem.. ;)so.. use a [b]SELECT id, title FROM categories ORDER BY categories[/b]..The result.. create your menu!=) D.Soul Quote Link to comment https://forums.phpfreaks.com/topic/7869-help-with-menus/#findComment-28675 Share on other sites More sharing options...
poirot Posted April 19, 2006 Share Posted April 19, 2006 If you want it to expand with no need to refresh the browser or open a link, you would have to use Javascript (and to retrieve all the products from all categories upon page load).If not, you can make the a link for each category (like: ?cat=1), retrieve the chosen category ($_GET['cat']) and use this value to find all the products for the category (SELECT * FROM `products` WHERE category = "$_GET['cat']") Quote Link to comment https://forums.phpfreaks.com/topic/7869-help-with-menus/#findComment-28676 Share on other sites More sharing options...
stephdowney Posted April 19, 2006 Author Share Posted April 19, 2006 [!--quoteo(post=366524:date=Apr 19 2006, 01:01 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Apr 19 2006, 01:01 PM) [snapback]366524[/snapback][/div][div class=\'quotemain\'][!--quotec--]If you want it to expand with no need to refresh the browser or open a link, you would have to use Javascript (and to retrieve all the products from all categories upon page load).If not, you can make the a link for each category (like: ?cat=1), retrieve the chosen category ($_GET['cat']) and use this value to find all the products for the category (SELECT * FROM `products` WHERE category = "$_GET['cat']")[/quote]hey thanks for the help but i'm totally new!!any snippets of code ....i kinda understand but dunno how 2 put it all 2gether!cheers steph Quote Link to comment https://forums.phpfreaks.com/topic/7869-help-with-menus/#findComment-28704 Share on other sites More sharing options...
Darkness Soul Posted April 19, 2006 Share Posted April 19, 2006 [!--quoteo(post=366524:date=Apr 19 2006, 03:01 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Apr 19 2006, 03:01 PM) [snapback]366524[/snapback][/div][div class=\'quotemain\'][!--quotec--](and to retrieve all the products from all categories upon page load)[/quote]I know that's work, but, guy.. drunk me before I do that.. do you think how long it can be? I know it have no real problem.. but.. x-x"If you want to do it (click on categorie and its drop down the data), think about use iframe to suporte dinamic querys.. then, when you click the categorie, its load the right query and recover the data.. I have no code sample with me here.. but look for it, is not a rare thing.. ^~=3 D.Soul Quote Link to comment https://forums.phpfreaks.com/topic/7869-help-with-menus/#findComment-28713 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.