Re: hotscripts style program
| From: | Marek Kilimajer | Date: | Sat, 04 Oct 2003 13:52:30 +0000 |
| Subject: | Re: hotscripts style program | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-165035@lists.php.net to get a copy of this message | ||
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