hi, i have come across in the need of the code written on the URL below http://snipplr.com/view/22864 Code (markup): i can integrate this code to my database and it works only for this query SELECT * FROM users Code (markup): it means it displays the tree of the Top Most Root only, But i don't have any idea what should be the sql query if i want to display the tree of a desired user in the database. :-( please help me. my table is users columns are id name my_node_id my_root_id my_left_node my_right_node
Do you have the variables at the top of tree_example() filled with the proper data? The code shown prints a tree for the data shown in the $rows[] array, not the data from your database.
You read the database into an array named $rows[], structured the same way as the array in the example code. And comment out the part of the code that loads the $rows[] array (lines 19-27).
Hi Rukbat, yes you are right, But this code need some modification to get it done for any node in the database. But this code words only for the first node in the database and does not work for any other node. that 19 to 27 can be get by using $result = mysql_fetch_array($sql,MYSQL_ASSOC); Code (markup): but the problem is it does not displays desired user's tree, it only displays the first user's tree, Thats y this code need modification or need a good sql query that can overcome this problem :-| can i share more info with you for this problem?
You do the select for the desired user's data, not for the first user's data. The code you linked to is only the tree display, not the method of getting the data to display. If you want all of it in one package, try http://dhtmlx.com/docs/products/dhtmlxTree/index.shtml The free version should be more than enough for what you need.
Hi Rukbat, thanks for you help, yes you are right, But for the above QUOTE text, i don't know how can i get the desired nodes from the SQL query, Could you please help me with the SQL query that only fetch only the desired data? OR i can get all the desired data via traversal and put it into array, So we will have all the desired data into an array. i also tried this but, that script go to infinite loop :-( thanks for the link for integration of tree, but i have to get all the data from database. So first we have to get the proper and correct tree display on the page and then we can integrate it with the DHTML treeview thank you