Structure of the table category:
id | parent_id | name
----------------------
1 | NULL | test1
2 | NULL | test2
3 | 1 | test3
4 | 1 | test4
5 | 3 | test5
6 | 2 | test6
7 | 6 | test7
8 | 3 | test8
It is tree.
So, this is what I want in PHP: I have id (it can be function argument), for example 5 and I want generate select tags, (in this example 3 level) so I want generate something like this: https://jsfiddle.net/Lh8y2mzh/
test6
and test7
are not in select and this is what I want. It should work recursively I think. Any help? How to make the function?