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:
To have two categories display, I tried the following code which does not work:
Am I anywhere close on this one? I sure hope this can be done.
Thanks to anyone who can help.
Deborah
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
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
Product Development
Re: [Luke] categories + using an "or" with "where"
By Deborah - January 4, 2010
Luke,
SUCCESS!!! Thanks so much. I hadn't tried that exact combination. I can use this code on several of the projects I'm working on.
[:)]
Deborah
SUCCESS!!! Thanks so much. I hadn't tried that exact combination. I can use this code on several of the projects I'm working on.
[:)]
Deborah