Mungkin fungsi atau do.. while loop mungkin dalam urutan? Bukti konsep:
function menuQuery($id)
{
$query = "SELECT * FROM site_menu WHERE Menu_ParentID = $id";
if ($query) {
foreach($query AS $q) {
//run through the results
menuQuery($q->id);
}
}
}
//initial call of top level menu items
menuQuery(0);