Displaying multiple records that have same list field value

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

By depdesign - April 20, 2010

I'm trying to find a way where I can display records from a section by the value from a pulldown list created in the CMS.

For example, below is a sample dropdown list field (Field Name: entertainment) in the CMS for a section titled "media".

Music|Compact Disc
Music|Radio
Music|Ipod
News|Newspaper
News|Televison

I want to display records on a page that have the value of Music to appear on a page.

Below is the code I tried:
list($mediaRecords, $mediaMetaData) = getRecords(array(
'tableName' => 'media',
'where' => "entertainment = \"Music\"",
));

This does not display anything.

If I do this....

list($mediaRecords, $mediaMetaData) = getRecords(array(
'tableName' => 'media',
'where' => "entertainment = \"Compact Disc\"",
));


It only displays the one record that has Compact Deisc selected in the list.
Dan Perez

Re: [depdesign] Displaying multiple records that have same list field value

By Jason - April 20, 2010

Hi,

If there is any other kind of search happening on the page, that may be causing the problem. Try this:
list($mediaRecords, $mediaMetaData) = getRecords(array(
'tableName' => 'media',
'allowSearch' => 0,
'where' => "entertainment = \"Music\"",
));


If this doesn't work, replace the 'allowSearch' line with this:

Give that a try and let me know if it works.
'debugSql'=>1,

Then run the script and post what it's outputting.

Give that a try and let me know if it works.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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