Using list value in where clause

5 posts by 3 authors in: Forums > CMS Builder
Last Post: June 1, 2011   (RSS)

By zaba - May 31, 2011

I want to pull data from the database dependent on what section it belongs to. the section is determined in cmsb by use of a list field which can have multiple choices, ie. a record can belong to section1 or section2 or both. I incorrectly assumed that I would be able to do this to pull the records:

list($videosRecords, $videosMetaData) = getRecords(array(
'tableName' => 'videos',
'loadUploads' => '0',
'allowSearch' => '0',
'where' => 'section="section1"',
));


can anyone help?

Re: [zaba] Using list value in where clause

By Jason - May 31, 2011

Hi,

Could you provide some more information on what you're trying to accomplish? Are you trying to select records from different sections that have selected a video?

Please let me know as much information as you can and we'll suggest some options.

Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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

Re: [Jason] Using list value in where clause

By zaba - May 31, 2011

In the cms I have a multi record set. One of the fields (section) is a list field with checkboxes, so checkbox 1 has a value and checkbox 2 has a value. I want to pull records in the viewer dependent upon what the value of section is.

I want to list all entries that match

where => 'section="the value of checkbox1"'

hope this helps explain what I am doing.

Re: [zaba] Using list value in where clause

By zaba - June 1, 2011

Ok,
I have split out the values rather than a multi pull down check boxes (where i wanted the option of appearing in 1 or both sections) I have done them as individual sections. So each section has its own checkbox field. There is a problem with the cms however, the cms allows you to put a value in the checkbox 'yes' and checkbox 'no' fields, however when initiating a where clause you can not put where => 'fieldname="yes"', you have to put where =>'fieldname="1"', or 0 depending on what you want. It should be the value, if you are allowed to put a value in there?