items
itm_id - auto_increment primary key
itm_name - varchar index
itm_summary - text
itm_parent - links back to itm_id
Then you can select from the table with a recursive function to build your tree like this
<?php
function build_menu($selected,$level) {
$retval = array();
if(is_array($selected)) {
foreach($selected as $current) {
if(!is_int($current))
return FALSE;
} //end foreach
} elseif(!is_int($selected))
return FALSE;
else
$selected = array($selected);
if(!is_int($level))
return FALSE;
if($level == 0)
$sql = "SELECT * FROM items WHERE itm_parent = 0";
else
$sql = "SELECT * FROM items WHERE itm_parent = " . $selected[($level -1)];
$query = mysql_query($sql);
while($row == mysql_fetch_assoc($query)) {
$retval[$row['id']] = array('name' => $row['itm_name'],'smry' => $row['itm_summary']);
if($row['itm_id'] == $selected[$level] && count($selected) > ($level +1))
$retval[$row['id']]['children'] = build_menu($selected,($level+1));
} //end while
return $retval
} //end build_nemu
?>
This code is not tested and probably needs to be debugged.