Syntax Help (more than one criteria in $options['where'] line)

3 posts by 2 authors in: Forums > CMS Builder
Last Post: April 24, 2008   (RSS)

By rasbro - April 24, 2008

I can't get this to work. I want to be able to assign articles to more than one topic or section. To do this I have 3 drop down lists that allow me to choose which default topic or other additional topics the article will appear. So far I am doing it this way and have tried both versions:

$options['where'] = 'default_topic = "Grilling Tips"'; 'other_topic1 = "Grilling Tips"'; 'other_topic2 = "Grilling Tips"';

$options['where'] = "default_topic = 'Grilling Tips'"; "other_topic1 = 'Grilling Tips'"; "other_topic2 = 'Grilling Tips'";

The article shows up when the "default_topic" drop down is selected but not when I choose the "other_topic1" or "other_topic2" drop down selection for the article. So, unless the article is assigned to the "default_topic" selection, it does not show up.

Any ideas? I have tried other syntax, like separating the options with a comma or other ways but always get a syntax error.

Thanks,
Brian

Re: [rasbro] Syntax Help (more than one criteria in $options['where'] line)

By Dave - April 24, 2008

So you want a where that matches any of the 3? Is that right? Try this:

$options['where'] = 'default_topic = "Grilling Tips" OR other_topic1 = "Grilling Tips" OR other_topic2 = "Grilling Tips"';

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com