0
所以我正在开发一个CMS,它将允许用户通过数据库表“遍历”。我在实施时遇到了一些麻烦,并且想知道是否有人有任何建议。MySQL dot-traversal ...可能吗?
Table: house
name (varchar), town (relationship, using the rel table)
Table: town
name(varchar), state (relationship, using the rel table)
Table: state
name(varchar)
Table: rel
id1, id2, rel_type
以下示例显示了其预期用法。它写道:“查找阿拉斯加州内的10个房屋,按名称排序”。
<?php
$Record = new Pod('house');
$Record->findRecords('name ASC', 10, "town.state.name = 'Alaska'");
?>
作为一个方面说明,我可以很容易地一个小镇的名字中找到的房子,因为MySQL支持[表] [点] [列名]:
<?php
$Record = new Pod('house');
$Record->findRecords('name ASC', 10, "town.name = 'Great Falls'");
?>
我总是把“状态”字段直接放入“house”表中,但用户需要能够引用其他列中的列。提前致谢!