[英]MySql PHP tree view
I am building a web application for an affiliate program and on the users
table I have this structure: 我正在为会员计划构建Web应用程序,并且在
users
表上具有以下结构:
Based on this MySql table I want every user to be able to see his tree, so I need this query: 基于此MySql表,我希望每个用户都能看到他的树,因此需要此查询:
if your table structure really looks like this you ned to define a function or easier do it in a recursive lookup in your language (php), but its a really inefficient way. 如果您的表结构确实看起来像这样,则您需要定义一个函数或更容易以您的语言(php)进行递归查找,但这实际上是一种低效的方式。 read this article it deals with this recursive and other teqniques.
阅读这篇文章,它涉及到这种递归和其他术语。
it explains storing of hirachical data in databases better than i could: http://articles.sitepoint.com/article/hierarchical-data-database 它比我更能解释数据库中的多层次数据存储: http ://articles.sitepoint.com/article/hierarchical-data-database
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.