You would need to pass the category ID around, perhaps in a GET. Such as like: index.php?category_id=6. You would then use that ID to get the sub categories. All the sub categories should have a parent category ID.
SELECT name FROM sub_categories WHERE category_id = 6
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
So lets say I want 'programming' subcategories.
select category_id, category_name, category_path from cateogires WHERE category_parent = '1'
and to do the breadcrumbs, I would split 'category_path' into the following format '0', '1' so then I could do
SELECT category_id, category_name, category_path FROM categories WHERE category_id IN ('0', '1').
You will need to keep an array to make sure the rows returned are forced into the correct order for hte breadcrumbs though.
For this, it takes two queries to get the current category and subcategories.