This is a discussion on Categories, subcategories table design within the MySQL forums, part of the Database Server Software category; --> i will have a table for categories something like id parent_id title so that i can put multiple depth ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| i will have a table for categories something like id parent_id title so that i can put multiple depth categories like aaa >> bbb >> ccc >> ddd the problem is that when the user clicks aaa the site should show all products in both aaa and its children and grandchildren like in bbb, ccc , ddd etc. i can make this with giving ids that contains parent ids like aaa aaabbb aaabbbccc aaabbbcccddd and use "where category_id like 'aaa%' " but i don't what to use such thing because when i have thousands of products it will take too much time. is there any solution for this with integers etc. Thanks for your help... |
| |||
| ars_oguz wrote: > i will have a table for categories something like > > id > parent_id > title > > so that i can put multiple depth categories like > > aaa >> bbb >> ccc >> ddd > > the problem is that when the user clicks aaa the site should show all > products in both aaa and its children and grandchildren like in bbb, > ccc , ddd etc. > > i can make this with giving ids that contains parent ids like > > aaa > aaabbb > aaabbbccc > aaabbbcccddd > > and use "where category_id like 'aaa%' " > > but i don't what to use such thing because when i have thousands of > products it will take too much time. > > is there any solution for this with integers etc. > > Thanks for your help... Take a look at these: http://www.sitepoint.com/article/hie...-data-database http://dev.mysql.com/tech-resources/...ical-data.html http://www.intelligententerprise.com...KH0C JUNN2JVN |
| ||||
| On Aug 26, 9:35 pm, "Paul Lautman" <paul.laut...@btinternet.com> wrote: > ars_oguz wrote: > > i will have a table for categories something like > > > id > > parent_id > > title > > > so that i can put multiple depth categories like > > > aaa >> bbb >> ccc >> ddd > > > the problem is that when the user clicks aaa the site should show all > > products in both aaa and its children and grandchildren like in bbb, > > ccc , ddd etc. > > > i can make this with giving ids that contains parent ids like > > > aaa > > aaabbb > > aaabbbccc > > aaabbbcccddd > > > and use "where category_id like 'aaa%' " > > > but i don't what to use such thing because when i have thousands of > > products it will take too much time. > > > is there any solution for this with integers etc. > > > Thanks for your help... > > Take a look at these: > > http://www.sitepoint.com/article/hie...tml;jsessionid... Thanks, that is what i have been looking for... |