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 Jason - August 26, 2010

Hi,

Is the advanced sql statement part of a brand new field, or did you modify a field that was already there? If you just modified it, records using the old field would still have their old values. That could account for this.

If that's not the case, I'll need to take a closer look at the records where this is happening. If you could email your FTP Details and CMS Information to jason@interactivetools.com and let me know which page you're experiencing this error, I can take a closer look.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/