So I'm working on a CMS that will allow users to "traverse" through database tables. I'm having some trouble implementing it though, and am wondering if anyone has any suggestions.
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
The following example shows its intended usage. It reads, "Find 10 houses within the state of Alaska, ordered by name".
<?php
$Record = new Pod('house');
$Record->findRecords('name ASC', 10, "town.state.name = 'Alaska'");
?>
As a side note, I can easily find houses within a town name, since MySQL supports [table][dot][column_name]:
<?php
$Record = new Pod('house');
$Record->findRecords('name ASC', 10, "town.name = 'Great Falls'");
?>
I could always put a "state" field into the "house" table directly, but users need the ability to reference columns from other columns. Thanks in advance!