unlimited category hierarchy
Hi all i am looking for a way to do this:
cat1
--sub1
---subsub1
----subsubsub1
-----subsubsub1
That kinda thing, at the moment i am using this:
But the only as you can tell goes up to a maximum of 2 subcategory's, i have to add more to the sql query for each new sub category.
Is there any real easy way to do what i want?
Hi all i am looking for a way to do this:
cat1
--sub1
---subsub1
----subsubsub1
-----subsubsub1
That kinda thing, at the moment i am using this:
PHP:
$sql = 'SELECT parent.catname AS parent_catname
, sub1.catname
, sub2.catname
FROM categories AS parent
LEFT OUTER
JOIN categories AS sub1
ON sub1.cparent = parent.catid
LEFT OUTER
JOIN categories AS sub2
ON sub2.cparent = sub1.catid
WHERE parent.cparent = 0 AND parent.ourscript = 0
ORDER
BY parent.catname
, sub1.catname
, sub2.catname';
But the only as you can tell goes up to a maximum of 2 subcategory's, i have to add more to the sql query for each new sub category.
Is there any real easy way to do what i want?







