where statement question
2 posts by 1 authors in: Forums > CMS Builder
Last Post: March 3, 2011 (RSS)
By 4cdg - March 2, 2011
I have serveral viewers where i need to show certian records based on 2 different fields, both are list fields.
I have accomplished this to some degree with where statement at top using AND or OR.
this works if field 1 is one selection and field 2 is one selection. say field 1 value is option 1 and field2 is option 3
my current where statements look like this and they both work
'where' => "section='2' AND type='Car'",
and
'where' => "section='trac' OR section='trail' OR section='equip'",
if i want to show on viewer all records that are field1 = option1 and field2 = option3 or option4 or option5 how do i accomplish that. and/or can i do it with code similar to that above.
I have accomplished this to some degree with where statement at top using AND or OR.
this works if field 1 is one selection and field 2 is one selection. say field 1 value is option 1 and field2 is option 3
my current where statements look like this and they both work
'where' => "section='2' AND type='Car'",
and
'where' => "section='trac' OR section='trail' OR section='equip'",
if i want to show on viewer all records that are field1 = option1 and field2 = option3 or option4 or option5 how do i accomplish that. and/or can i do it with code similar to that above.
Re: [4cdg] where statement question
By 4cdg - March 3, 2011
I figured out what i was doing wrong. I just had to add () around my OR statements and it works