populate list field based on another list field's selection

14 posts by 3 authors in: Forums > CMS Builder
Last Post: May 24, 2009   (RSS)

By ross - May 13, 2009

Hi there.

I am a little lost on this one now. Are you working inside the forloop for your images?

Could you give me a bit more detail? Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ross] populate list field based on another list field's selection

By atomicrabbit - May 13, 2009 - edited: May 13, 2009

Ok let me give you an example. If I use the normal query,

list($locRecords, $locMetaData) = getRecords(array(
'tableName' => 'locations',
'where' => 'country="whatever"',
));


It will return the fields in the locations table based on the where statement and I'll be able to loop through the images field using $locRecords['image']['isImage'], $locRecords['image']['thumbUrl'], etc variables. BUT since I need to use multiple where statements, I cannot use the above code. As far as I know, it doesn't support multiple where statements -- i.e. "where w=x AND y=z", which is what I need so I'm forced to use a standard MySQL statement to query the database:

$locRecords = mysql_query_fetch_all_assoc("SELECT * FROM cms_locations WHERE country='" . $_REQUEST['c']
. "' AND province_state='" . $_REQUEST['ps'] . "' AND city='" . $_REQUEST['ci'] . "' ORDER BY country, province_state, city");


BUT, using this does not give me the variables such as $locRecords['image']['isImage'] or $locRecords['image']['hasThumbnail'] or $locRecords['image']['thumbUrl'] (as far as I know)... how do I get those variables using a standard MySQL statement as opposed the to first code snippet.

Re: [ross] populate list field based on another list field's selection

Thanks ross, worked like a charm...

it's weird though -- that's the FIRST thing I tried and for whatever reason, it didn't work the first time. [:/]

Anywho, all is well now. Thanks again!