function getParent($parent_id){
$sql = " select xx from t2 where parent_id = $parent_id "
while $rs = fetch_array(query($sql)){
$txt .= $rs['menu_name']
}
return $txt;
}
$sql = " select xx from t1 "
while $rs = fetch_array(query($sql)){
getParent($rs['parent_id']);
}