I am almost finished with my download manager but I am having on big problem.
Ok, I've got one table kdd_filesinside that table I have the following columns:
file_id
file_cat_id
file_location
file_title
file_long_desc
file_short_desc
file_downloads
and in my kdd_categories table I have this:
cat_id
cat_parent_id
cat_title
I have it set up where you can have UNLIMITED nested categories just by changing the cat_parent_id. When I want to get the # of files in the lowest category I can do that.
Main Cat 1
So if I want to get the number of files in Sub-Sub Cat all I do is run this query:
SELECT * FROM $db[4]_files WHERE `file_cat_id` = '$_GET[id]`
note: $db[4] is the variable that holds the db prefix( in this case 'kdd')
My problem is that I need to get the total number of files in Main Cat 1. How can I set up a loop that will go through all subcategories and add them up?
Any help would be much appreciated.