You need to create a recursive function:

// pseudo code
function count_content($cat_id) {
        SELECT COUNT(*) FROM content WHERE cat_id='$cat_id'
        $count=sql_result();
        SELECT cat_id FROM categories WHERE cat_id='$cat_id'
        while($cat_id2 = sql_result()) {
                $count += count_content($cat_id2);
        }
        return $count;
}

Ryan A wrote:
Hey,
Anybody have any code or links to explain how to make a program like the one
running on hotscripts?
eg:
when you visit there you have a couple of categories like : ASP, JAVA, PHP
etc
(if you select php)
PHP
--Scripts
--Books
--tutorials
(if you select scripts)
--Scripts
----category1(324)
----category2(24)
----category3(54)
etc

the number in brackets at the side of the category says how many records....

I downloaded PHPlinks but have been unable to understand it.
Another good place that i visited was
http://www.hotscripts.com/PHP/Scripts_and_Programs/Software_Repository/index.html
and even searched on google but cant find much.

Any help appreciated.

Thanks,
-Ryan


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to