I have a persons table in mysql db, every person has mother and father, so I need to build the inheritance tree and I have a function for that, if just run it, it works fine, but I need to define the depth of inheritance tree, I made reference variable for that, it counts the recursion well but there is another problem, it makes tree only for mother line, if I switch 'if' statements it will build only father tree, how can I make it work or maybe there is another way to do it?I have a persons table in mysql db, every perso