I am having a difficult time trying to come up with a bit of code...
Here's the task at hand... I am developing a directory script and the client wants to display stats within each category that tells how many categories (sub-categories, sub-sub-categories, etc.) and links are in the currently viewed category... Links aren't the problem because I plan on building an array storing all the category IDs and then just run through them counting links... but to continue to dive deeper and retrieve the category IDs has become a bit difficult for me to figure out.
The categories are given an ID by auto increment upon insertion into the database and its parent category's ID is referenced within its row...
So, my question is:
What is the simplest way to collect all the children categories' IDs? Each method I come up with has potential of getting stuck in an endless loop...