Home  >  Article  >  Backend Development  >  关于php、mysql,二叉树高手来帮忙,怎么计算下面某个节点是否在某节点下面

关于php、mysql,二叉树高手来帮忙,怎么计算下面某个节点是否在某节点下面

WBOY
WBOYOriginal
2016-06-13 12:38:35830browse

关于php、mysql,二叉树高手来帮忙,如何计算下面某个节点是否在某节点下面?

本帖最后由 kwdpx 于 2013-09-05 16:57:47 编辑


数据库member结构:
编号     上级ID    金额
id      sh1    jine
1001    999    49
1002    1001   20
1003    1001   29
1004    1002   10
1005    1003    12
1006    1002    10
1007    1006    4
1008    1003    17
1013     1008    8
1015    1006    6
1021    1008    9
……

比如想知道ID:1021在不在1003下面?如果在就显示在,如果不在1003下面就显示不在:

if(){
echo "在";
}else{
echo "不在";
exit();
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn