title: Filter recordset from one table based on selected row from another table
body: <p>I am working on a product configurator (php/mysqli) where a master table stores (page-by-page procedurally) IDs from associated option tables.</p>
  
  <p>What I'm trying to do is filter option recordsets based on a previously selected/stored option compatibility.</p>
  
  <p>The following example should illustrate:</p>
  
  <p><strong>Master Table</strong></p>
  
  <pre><code>| ZOO_AREA_ID | ANIMAL_ID | ENCLOSURE_ID |
  | 6           | 1         | 5            |
  | 7           | 2         | 6            |
  | 8           | 3         | ??????       |
  </code></pre>
  
  <p><strong>Animal Table</strong></p>
  
  <pre><code>| ANIMAL_ID | ANIMAL | ENCLOSURE_TYPE_IDS |
  | 1         | Mouse  | 2,5,6              |
  | 2         | Lizard | 6                  |
  | 3         | Crab   | 3,4                |
  </code></pre>
  
  <p><strong>Enclosure Table (Options for menu list)</strong></p>
  
  <pre><code>| ENCLOSURE_ID | ENCLOSURE         |
  | 1            | Large walled area |
  | 2            | Wire Cage         |
  | 3            | Oceanarium        |
  | 4            | Water Tank        |
  | 5            | Hutch             |
  | 6            | Vivarium          |
  </code></pre>
  
  <p>So, if I'm configuring ZOO_AREA_ID row 8 in the master table and I have already selected and updated ANIMAL_ID 3 (Crab). I want to create a recordset for a drop-down that limits results in the Enclosure Table where the ENCLOSURE_ID is listed in the ENCLOSURE_TYPE_IDS of the Animal table.</p>
  
  <p>In this case, the recordset result should be:</p>
  
  <pre><code>| ENCLOSURE_ID | ENCLOSURE  |
  | 3            | Oceanarium |
  | 4            | Water Tank |
  </code></pre>
  
  <p>What's the best way to achieve this?</p>
  
  <p>Any help would be appreciated.</p>