Page 1 of 1

How to crate a categoru and subcategory tree using Mysql in

Posted: Sun Dec 07, 2008 12:27 pm
by bhallash
hi ,
i want to to dispaly a list of categories and subcategories in a listbox so that user can easily select the right place to publish add. can any body give me idea ?

Re: How to crate a categoru and subcategory tree using Mysql in

Posted: Sun Dec 07, 2008 12:53 pm
by alex.barylski

Code: Select all

group_1
--------
pkid, name
 
group_2
--------
pkid, fkid, name
group_1 represents items or that group...group_2 represents names in sub-groups by association with fkid which points to the records in group_1.

A better way would be to implement an arbitrary depth tree but that is slightly more complicated and possibly overkill if all you need is two levels, like make and model.