title: PHP, deleting a category from unlimited category table
body: <p>I would like to know what is the best way to achieve deleting a category (with all sub categories) from unlimited category table.</p>
  <p>I was planing to go with;</p>
  <ul>
  <li><p>Delete the category and sub-categories.</p>
  </li>
  <li><p>Since it is unlimited category system, in the end run another function to clear categories which has no parent_id records in the table.</p>
  <p>Is there any other, preferably more elegant way to achieve this?</p>
  </li>
  </ul>
  <p><strong>Edit:</strong>
  My category table's structure</p>
  <pre><code>array(8) {
    [&quot;id&quot;]=&gt;
    NULL
    [&quot;parent_id&quot;]=&gt;
    NULL
    [&quot;siteID&quot;]=&gt;
    NULL
    [&quot;memberGroups&quot;]=&gt;
    NULL
    [&quot;name&quot;]=&gt;
    NULL
    [&quot;language&quot;]=&gt;
    NULL
    [&quot;protectDelete&quot;]=&gt;
    NULL
    [&quot;typeID&quot;]=&gt;
    NULL
  }
  </code></pre>
  <p>Thank you for your time and concern.</p>