|
Posted by Gosiek on 10/13/31 11:25
Hello everyone,
My idea is to creat tree menu (see http://www.allegro.pl/category_map.php),
for example:
Computer
PC
Intel
AMD
Laptop
Intel
AMD
Books
Albums
Fantasy
Computer Science
Programming
Networks
Comiks
...
and so on.
And I'm not sure how to creat the tables. I had two ideas:
1. Creat first table with main category: id_main_category,name; Second
table with under category: id_under_category, id_main_category, name;
Third table with next under category: id_under_category2,
id_under_category, name and so on.
2. Creat one table with:
Id, name, parent_id:
1 Computer 0
2 Laptop 1
3 AMD 2
4 INtel 2
5 PC 1
6 INTEL 2
7 AMD 2
8 Books 0
9 Computer Sciense 1
10 Programing 2
11 Networks 2
But this two ways are not very good. In first one I will have to write
long query with many select in select if I would like to select every
under category for Computers. I second one I don't have any relationship
and I don't know how could I select some data.
Can you give me any advice how to resolve this problem?
Best rgds,
Gosiek
Ps. As always sorry for my english.
Navigation:
[Reply to this message]
|