...And Then My Brain Turned to Cheese!

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

Re: [Perchpole] ...And Then My Brain Turned to Cheese!

By robin - April 11, 2011

Hey Perch,

Since you are doing 'LIKE' searches you can't use the IN function. So we need to change your $activePanels array a bit. Then implode it to mysql OR conditions after that.

Using implode can be a bit hard to understand at first, but it can be really handy in situations like this.
http://php.net/manual/en/function.implode.php

Here is a possible solution:
foreach($panelRecords as $panels){

if($panels['categorySelector'] == $selectedCategory['num']){
$activePanels[] = "'%\tpanelSelector\t%' = '%\t$panels\t%'"
}
}
$activePanelsWhereCondition = '';
$activePanelsWhereCondition = implode(" OR ", $activePanels);

list($boxesRecords, $boxestMetaData) = getRecords(array(
'tableName' => 'boxes',
'where' => $activePanelsWhereCondition,
));


Hope that helps,
Robin
Robin
Programmer
interactivetools.com

Re: [robin] ...And Then My Brain Turned to Cheese!

By Perchpole - April 11, 2011

Hi, Robin -

I feel another fondue moment coming on just looking at this!

Seriously, this is great. I really love ingenious stuff like this.

:0)

Perchpole