Read this article: http://www.evolt.org/article/Four_ways_to_work_with_hierarchical_data/17 /4047/index.html
It explains the 4 different methods that you can use when working with hierarchical data. -----Original Message----- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2003 3:21 PM To: [EMAIL PROTECTED] Subject: [PHP] Category and sub-category logic Hi, I am thinking of making a program for personal use which does a very simple thing, just displays listings under categories, eg: under main category "Auto" there would be "cars","bikes" etc under "banking" there would be "financing","loans" etc (I as admin create master and sub-categories) then if you click on "cars" you would either see a sub category or all the listings there I have never done a project like this so am a bit confused but I am pretty sure quite a few of you must have done this because its a bit common on the net and while I am kind of new to php, most of you guys are fossils :-D So far the logic I have worked out is: Create a "master_category" table for the main categories, a "child_table" for the subs, a "the_listings" table for the details which will have a reference (number or word) field which will be to keep a reference as to which category/sub-category it belongs to.. Tell me if my logic is wrong or I missed anything The part where I am confused is, on the front page (say index.php) how do I display all the categories and sub categories in the correct order? eg: Auto --Cars --Bikes Banking --Finances --Loans Women --Boring but REALLY good looking --Great fun but not-so-good-looking Any ideas? I searched hotscripts and google but found crappy programs like phpyellow and zclassifieds which are really no good to me. If you know of something that already does the above kindly share it with me. Thanks, -Ryan ------------------- ----------------- The government announced today that it is changing it's emblem to a condom because it more clearly reflects the government's political stance. A condom stands up to inflation, halts production, destroys the next generation, protects a bunch of pricks, and gives you a sense of security while you're actually getting screwed. ------------------- ----------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php