We have subfolders with parent-child relationships. We use MySQL MyISAM DB. Data is stored in the database as follows.
Each time a child folder is created in a nested structure, the previous parent identifier is added. I want to get the RootFolderID from a folder that is added to the hierarchy, as shown below.
FoldID ParentID |RootFolderID
-----------------|-------------------
1 0 | 0
2 1 | 1
3 2 | 1
4 3 | 1
5 4 | 1
Please let me know how to get the root folderID and fill it in the RootFolderID column after creating the folder every time.
Thank.
source
share