如何用 PHP 构建推荐系统?
我有一个带有推荐系统的网站,我希望用户能够使用树视图查看他们推荐的用户。
我的数据库表的设置是这样当用户用他的推荐代码推荐某人时, 新用户会获得一个 ID、一个赞助商代码(来自他的“赞助商”,也就是让他进入此网站的人的推荐代码)和一个推荐代码(他自己的推荐代码,用于让其他人加入他的团队)。
我不知道如何从 MySQL 数据库中获取此信息并将其放入树视图脚本中。
我需要能够让用户看到他推荐的所有人员,深度为 10 层。
这可能吗?我该怎么做?
I have a website with a referal system, and I want the users to be able to see what users they referred, using a treeview.
My database table is set up so that when a user refers somebody with his referal code,
the new users gets an ID, a sponsor code (the referal code from his "sponser" aka the person who got him into this site) and a referal code (his own referal code to get other people to join under him).
I have no idea how i can get this info out of my MySQL database, and into a treeview script.
I would need to be able to let the user see all the people that he referred, 10 levels deep.
Is this possible and how could I do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该查看分层数据(http://www.sitepoint.com/hierarchical-data -数据库/)
You should give a look at hierarchical data (http://www.sitepoint.com/hierarchical-data-database/)