Jump to content

tree view from database...


pfkdesign

Recommended Posts

hi everyone.

I would like to know whether you know how i can show the result of many to many relation in trees?

here is the description:

there are 3 table

1) users: id_usr, nanme , family ...

2) menu: id_mnu, idmnu_mnu (it is Parent ID), lable_mnu, url_mnu...

3) qualification_join_usr :  qualification_id, users_id

 

here are the codes.

 

 SELECT menu.translation_id, menu.label_mnu, qualification_join_usr.users_id
FROM menu LEFT JOIN qualification_join_usr ON (qualification_join_usr.qualification_id=menu.translation_id AND qualification_join_usr.users_id=0123456789)

 

...

 

echo "<ul>";

  $cnt2 = 0;

  if ($totalRows_rsuser_usr>0) {
    $nested_query_rsmenu = str_replace("123456789", $row_rsuser_usr['id_usr'], $query_rsmenu);
    mysql_select_db($database_rsheattreat);
    $rsmenu = mysql_query($nested_query_rsmenu, $rsheattreat) or die(mysql_error());
    $row_rsmenu = mysql_fetch_assoc($rsmenu);
    $totalRows_rsmenu = mysql_num_rows($rsmenu);
    $nested_sw = false;
    if (isset($row_rsmenu) && is_array($row_rsmenu)) {
      do { //Nested repeat


			echo "<li>";
					 echo $row_rsmenu['label_mnu'];
			echo "</li>";

      } while ($row_rsmenu = mysql_fetch_assoc($rsmenu));
    }
  }
echo "</ul>";
?>

 

so in this way it list all of the records in 1 level , i have 4 level deep in this list

so i need to list all like :

level 1

--level1-1

--level1-2

level2

.

.

...

 

any idea? ??? ???

Link to comment
https://forums.phpfreaks.com/topic/122152-tree-view-from-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.