drew7721 Posted November 10, 2009 Share Posted November 10, 2009 Hi! I'm looking to make a dropdown menu based on a db table SQL table: Categories cat_id = INT auto_increase PRIMARY cat_name = VARCHAR (80) parent_id = INT NOT NULL default 0 ------------- Now I want to populate this table with categories and sub categories. Main categories get 0 as parent_id Now I want to add a sub cat so I'll give it a parent_id = 1 for it's parent cat to be the cat with cat_id =1 But I want to make a dropdown menu on site that will show PARENT CAT 1 ---subcat 1.1 ---subcat 1.2 PARENT CAT 2 ---subcat 2.1 ---subcat 2.2 PARENT CAT 3 PARENT CAT 4 ---subcat 4.1 ETC! how do I do this? I've been killing myself over this? can someone help please??? Quote Link to comment https://forums.phpfreaks.com/topic/181040-php-sql-menu-list-with-subcast/ Share on other sites More sharing options...
gizmola Posted November 10, 2009 Share Posted November 10, 2009 So it seems you have a fairly common database structure. What is it exactly, that you can't figure out. Quote Link to comment https://forums.phpfreaks.com/topic/181040-php-sql-menu-list-with-subcast/#findComment-955202 Share on other sites More sharing options...
JustLikeIcarus Posted November 13, 2009 Share Posted November 13, 2009 Check the post I just added to another thread http://www.phpfreaks.com/forums/index.php/topic,276686.msg1308826.html#msg1308826 I believe its what you want. Quote Link to comment https://forums.phpfreaks.com/topic/181040-php-sql-menu-list-with-subcast/#findComment-956856 Share on other sites More sharing options...
fenway Posted November 19, 2009 Share Posted November 19, 2009 Hierarchical data can be stored in a variety of ways... the stickies talk about this too. Quote Link to comment https://forums.phpfreaks.com/topic/181040-php-sql-menu-list-with-subcast/#findComment-960604 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.