Main
Index
Search
Posts
Who's
Online
Log
In

Home: Discontinued/Classic Products: Instant Website: Realty/Listings/Auto:
Linking Tables

 

 


hvbuilder
User

Sep 19, 2009, 11:10 AM

Post #1 of 3 (4696 views)
Shortcut
Linking Tables Can't Post

Hi,

I have a question. I'm using your instant realty website cms. I have created a table for counties, townships, and school districts.

The county table lists only counties. The townships table lists county and townships, and the school district table lists county and school districts.

I have created an editor called listings. I have a dropdown called county, another dropdown called township, and another called school district.

For the drop down for townships I have choosen a list option as: Get option from MySQL query advanced.

SELECT township FROM irw_townships WHERE (im stuck)

I want the townships from the selected county to be able to be selected

Any help would be appreciated.

Thanks,
James


Chris
Staff


Sep 22, 2009, 12:32 PM

Post #2 of 3 (4402 views)
Shortcut
Re: [hvbuilder] Linking Tables [In reply to] Can't Post

Hi James,

It's hard to know for certain what you need there without knowing how your tables and section are constructed; however, I can hazard a guess:

SELECT township FROM irw_townships WHERE county='<?php echo $ESCAPED_FILTER_VALUE ?>'

You'll also want to set the "refresh list" option so that your list field updates when it should:

Advanced Filter: Refresh list when this field changes: county

I hope this helps. Please let us know if you have trouble getting this working or have any questions.
Chris


hvbuilder
User

Sep 23, 2009, 5:05 PM

Post #3 of 3 (4338 views)
Shortcut
Re: [chris] Linking Tables [In reply to] Can't Post

Hi Chris,

Thank you. That worked perfectly!

Thanks again,
James