是这样的,最近做一套会员系统,其中有两个字段当前用户和推荐人。
我需要列出当前推荐人的所有父级推荐人。
比如:
当前用户->推荐人->推荐人的推荐人->推荐人的推荐人的推荐人->推荐人的推荐人的推荐人的推荐人...
这样一直叠上去,请问数据库表该怎么写?
我总不能:
$ref1 ='select * form `user` where refname = 'xxx' limit 1;
$ref2 = select * form `user` where refname = '$ref1' limit 1;
$ref3 = select * form `user` where refname = '$ref2' limit 1;
...
求写法!:(