categories + using an "or" with "where"

3 posts by 2 authors in: Forums > CMS Builder
Last Post: January 4, 2010   (RSS)

By Deborah - January 4, 2010

If this answer is in the forum, I can't find it!

I would like to display a list of records for two categories in a category list (checkboxes).

To show one category, I use the following:
list($calendarRecords2, $calendarMetaData) = getRecords(array(
'tableName' => 'calendar',
'where' => " category LIKE '%\Music - Events\t%' ",


To have two categories display, I tried the following code which does not work:
list($calendarRecords2, $calendarMetaData) = getRecords(array(
'tableName' => 'calendar',
'where' => " category LIKE '%\Music - Events\t%' or '%\Art - Events\t%' ",


Am I anywhere close on this one? I sure hope this can be done.

Thanks to anyone who can help.
Deborah

Re: [Deborah] categories + using an "or" with "where"

By Luke - January 4, 2010

Hi Deborah,

Thank you for posting.

It's a little tricky to troubleshoot this without being able to work with the code directly.

However, try using "category LIKE" before each match.

list($calendarRecords2, $calendarMetaData) = getRecords(array(
'tableName' => 'calendar',
'where' => " category LIKE '%\Music - Events\t%' or category LIKE '%\Art - Events\t%' ",

In the mean time, if you have any other questions please feel free to let me know.

Cheers,
Luke
Luke Holzken
Product Development