[eluser]WanWizard[/eluser]
A node is the parent of another node if $child->lft > $parent->lft and $child->rgt < $parent->rgt.
Note that this is true for any parent of the child node, not only for the immediate parent. If you only need the immediate parent, you need to query the database, get all records where lft < $child['lft'], rgt > $child['rgt'], order ASC on rgt, and LIMIT 1 to get the parent node.