I don't know of any terminology that would really fit this, but "recursive" is an important word: the means that the operations loop within themselves: a category can have a category .... can have a product.
Because of this, there will not be any easy ways.
You could create a very complex query (maybe) using MySQL to find all possible IDs, but I'm not sure how to generate this.
The easiest way would be to loop through in a recursive function in PHP that would do this (pseudo-code, as an example):
PHP Code:
function deletecategory($cat_id) { //delete a category by ID
$q = mysql_query("SELECT id... WHERE pid='$cat_id'");
while ($row = mysql_fetch_assoc($q)) {
if (ISCATEGORY($row['id'])) {
deletecategory($row['id']); //loop to the lower level
}
$q = mysql_query("DELETE FROM...... WHERE id='".$row['id']."';"); //remove this entry
}
}
Bookmarks