My MySQL looks like this: (the name of the table is category)
'id', 'content', 'parent'
where:
- id = the id of the category
- content = some-text-we-dont-care-about
- parent = the id of the parent category
this is what I'm trying right now:
function remrecurs($id) {
$qlist=mysql_query("SELECT * FROM category WHERE parent='$id'");
if (mysql_num_rows($qlist)>0) {
while($curitem=mysql_fetch_array($qlist)) {
remrecurs($curitem['parent']);
}
}
mysql_query("DELETE FROM category WHERE id='$id'");
}
Which for some reason doesnt work and crashes .. Any idea what I'm doing wrong ?