I have a simple MySQL table thats contains a list of categories, level is determined by parent_id:
id name parent_id --------------------------- 1 Home
AFAIK no.
This Sitepoint article may help you.
You could retrieve all the elements with one query, store it in an array and then iterate, as explained here and here