RE: [PHP] Subcategories in php
| From: | Ralph Guzman | Date: | Wed, 24 Sep 2003 07:30:52 +0000 |
| Subject: | RE: [PHP] Subcategories in php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-163699@lists.php.net to get a copy of this message | ||
This article explains four methods for doing this:
http://www.evolt.org/article/Four_ways_to_work_with_hierarchical_data/17
/4047/index.html
-----Original Message-----
From: phpu [mailto:phpu@go.ro]
Sent: Saturday, September 20, 2003 7:41 AM
To: php-general@lists.php.net
Subject: [PHP] Subcategories in php
Hi,
I have been trying to do this for weeks but i just cant figure this out.
I have categories that have subcategories and i want to insert them into
database. My table looks like this: cat_id, parent_id and cat_name.
Let's say i wanna insert a subcategory that is associated with its
parent category.
For example
ParentCat 1
ParentCat 1 > ItsSubCat 1
ParentCat 1 > ItsSubCat 2
ParentCat 1 > ItsSubCat 3
ParentCat 1 > ItsSubCat 4
ParentCat 2
ParentCat 2 > ItsSubCat 1
and so on ...
I don't know how to create the script that inserts any subcategory(in
this case let's say ItsSubCat 3) in its parent category.
Please, can someone help me
thanks