List Labels with my sql query

3 posts by 3 authors in: Forums > CMS Builder
Last Post: August 26, 2010   (RSS)

Hi,

I have a list field (within table insurance_options), will following code for the advanced my sql statement:

SELECT num,title
FROM `<?php echo $TABLE_PREFIX ?>hire_items`
WHERE (company = '<?php echo $ESCAPED_FILTER_VALUE ?>') AND (title NOT LIKE '%linen%') AND (title NOT LIKE '%chair%') AND (title NOT LIKE '% table%')


This works fine within the CMSB, giving me the correct list, using 'title' as the displayed value, and 'num' as the recorded value when viewing through CMSB in Insurance Options table.

However, when trying to display these list values ('title') on the viewer, it's only outputting num instead of require title/list value.

Code I'm using for that is:
echo join(', ', getListLabels('insurance_options', 'hire_items', $record['hire_items']));

This would work fine if I had the normal 'list options' selected for this field, but as soon as I put in the advancedsql field, it stops working correctly.

Any ideas?

Cheers

Re: [rjbathgate] List Labels with my sql query

By Dave - August 26, 2010

Hi Rob,

Because of the way those fields interact you pretty much have to look those values up manually with an SQL query.

Let me know if you need a hand with that.
Dave Edis - Senior Developer
interactivetools.com