nehapuniani Posted August 4, 2009 Share Posted August 4, 2009 hi, After goin thru many lot of links on internet, i have come up here. I am new to php and am trying to make a left navigational menu in php thru mysql data. I have recipe data, which needs to be displayed category wise, then name wise and clicking on name recipe shud come up. Appetizers (Category) ABC(Name) Can anybody help me to create a dynamic menu??? Also while searching on the net, the solution i inferred is that Category and name fields should be made in one column and their should be parent id (for root 0, first level 1 ...)if this is the solution, then is there any method to convert this table ('id', 'Category', 'Name', 'Recipe') to ('id', 'Name'(name + category), 'parentid') ur help wud be really appreciated!! Quote Link to comment https://forums.phpfreaks.com/topic/168766-dynamic-menu-data-from-mysql-with-php/ Share on other sites More sharing options...
RichardRotterdam Posted August 4, 2009 Share Posted August 4, 2009 To start we need to see what your database tables look like. Do you have some code so far? Quote Link to comment https://forums.phpfreaks.com/topic/168766-dynamic-menu-data-from-mysql-with-php/#findComment-890404 Share on other sites More sharing options...
nehapuniani Posted August 4, 2009 Author Share Posted August 4, 2009 The database table is : create table 'Recipe' ('Auto' int(10) default 0, 'Category' VARCHAR(255) default null, 'Name' VARCHAR (255) default null, Recipe Text ) TYPE = MYISAM; I want to create a menu which is order by Category selecting the Category related recipe Name should be populated. something like this I wud really appreciate ur help Quote Link to comment https://forums.phpfreaks.com/topic/168766-dynamic-menu-data-from-mysql-with-php/#findComment-890662 Share on other sites More sharing options...
nehapuniani Posted August 5, 2009 Author Share Posted August 5, 2009 Can anybody plzzzzz help me with this issue??????????????? Quote Link to comment https://forums.phpfreaks.com/topic/168766-dynamic-menu-data-from-mysql-with-php/#findComment-891106 Share on other sites More sharing options...
RichardRotterdam Posted August 5, 2009 Share Posted August 5, 2009 I wasn't able to run the query the quotes needed to be removed. I indented the create query so it's more readable and you might have a better response in the future create table Recipe ( Auto int(10) default 0, Category VARCHAR(255) default null, Name VARCHAR (255) default null, Recipe Text ) ENGINE = MYISAM; I have a bit of critique here on your table. 1. Why is your first field named auto??? shouldn't this be id or something similar. 2. You have category as text i'd create a different table for categories and set a relation with a foreign key 3. You have a field recipe in your table recipe. Maybe you should just name this field description so it's less confusing. Quote Link to comment https://forums.phpfreaks.com/topic/168766-dynamic-menu-data-from-mysql-with-php/#findComment-891115 Share on other sites More sharing options...
nehapuniani Posted August 5, 2009 Author Share Posted August 5, 2009 Ok, i have changed the table: Auto is id field Name, Catagory, Description My Category field is not that big it is VARCHAR (20). Please let me know how to go for creating dynamic menu Quote Link to comment https://forums.phpfreaks.com/topic/168766-dynamic-menu-data-from-mysql-with-php/#findComment-891366 Share on other sites More sharing options...
RichardRotterdam Posted August 5, 2009 Share Posted August 5, 2009 My Category field is not that big it is VARCHAR (20). It is not the reason why I say you are better of using a different table for categories. You might want to change a category name in the future. With the current database design you would have to manually rename all of the category names instead of doing it only once. Besides that you might want to fit a category in a category as in use subcategories. Please let me know how to go for creating dynamic menu What code do you have so far for selecting the results from the database? Are you using PHP? Quote Link to comment https://forums.phpfreaks.com/topic/168766-dynamic-menu-data-from-mysql-with-php/#findComment-891371 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.