Hi guys,
My first post here! Seems like this is the place to get wise ;)
I am currently in the middle of some testing with my first ever attempt to try the MPTT (Modified Preorder Tree Traversal) approach to storing data in my Mysql database with the help of PHP.
However, I am trying to find out the most performance-oriented way to get all list elements on a specific level, with a specific parent.
That could translate into getting the categories Saab and Chrysler from the image below, if the parent entered would be named "Bilar". (Which means Cars in Swedish, if that isnt your strongest side ;) )
As i cant post images, here's a link to the flowchart: http://www.phpsidan.nu/files/mptt/mptt1.png
Currently i have been doing two querys to do what i want, and quite some amount of code to calculate the level and spit out all the other elements on the same level.
Is there a better way to do this and by hopefully only using one query?
Thanks a lot!