I need help designing the logic of an app that I am working on. The application should enable users to create mindmaps and save them to a mysql database for later editing. Each mindmap is made up of inter-related nodes, meaning a node should have a parent node and the id of the mindmap to which it belongs. I am stuck here. How can I save the nodes to the database and be able to query and rebuild the mindmap tree from the query results.
Root Child1 Child2 GrandChild1 GreatGrandChild1 GreatGrandChild1 Child3 GrandChild2
I need an algorithm, that can save the nodes and also be able to figure out the relationships/order of items similar to the Tree that I have given. This is very much like how menus are saved and retrieved in Wordpress but I can't find the right logic to do this. I know there are really great people here. Please help.
I finally found a solution. Here's my full code.
This is based on the piece of code found here http://psoug.org/snippet/PHP-Recursive-function-to-generate-a-parentchild-tree_338.html I hope this helps someone as well