Multiple Selection List = where Filter

16 posts by 2 authors in: Forums > CMS Builder
Last Post: January 28, 2009   (RSS)

Re: [s2smedia] Multiple Selection List = where Filter

By Dave - January 26, 2009

Hi s2smedia,

It's a little more complicated with multi value fields. They're stored as tab separated values in the database so we need to use some mysql wildcard searches to see if the value is _in_ the list as opposed to being an exact match. Try this:

'where' => " academy LIKE '%\tFutsal Academy\t%' ",

LIKE means "matches this pattern", % means "any characters", and \t means tab.

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

Re: [Dave] Multiple Selection List = where Filter

That does it!!! Thanks A Million!!!

BTW this site is a MONSTER...power 100% by your great CMS. When its 100% complete I will make sure to post in the forum...

Re: [s2smedia] Multiple Selection List = where Filter

FYI that page works now... but check out my other post in this forum... its list a couple below this one.. "Filtering Question"

I figured out how to do that... but now that I changed it to multiple selection list... I think that code may need tweaked as well... I entered the code I used to make it work in the other Post...

Re: [s2smedia] Multiple Selection List = where Filter

By Dave - January 26, 2009

If it's using the url based searching system where you add: ?fieldname=value then it might work automatically. If not you can add keyword to do a keyword search rather than an exact match:

?fieldname_keyword=value

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Multiple Selection List = where Filter

OOpps sorry i thought i posted the code I used:

<?php if ($record['futsal_location'] != $winter_academy_locationsRecord['location']) { continue; } ?>


but now i need it to work with the multiple selection list

Re: [s2smedia] Multiple Selection List = where Filter

By Dave - January 27, 2009

Sure, which one is the multi value field?

Try something like this:

if (strpos($record['futsal_location'], $winter_academy_locationsRecord['location']) !== false) { continue; ?>

If that doesn't work try swapping the variables.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Multiple Selection List = where Filter

OK I added that to my code:

<?php foreach ($newsRecords as $record): ?>
<?php if (strpos($record['futsal_location'], $winter_academy_locationsRecord['location']) !== false) { continue; ?>
<?php $bgColor = (@$bgColor == "") ? '#666666' : ''; ?>
<table width="100%" border="0" cellspacing="0" cellpadding="8" >
<tr>
<th align="left" valign="top" bgcolor="<?php echo $bgColor; ?>" scope="col"><span class="newsheadlines2"><?php echo $record['date'] ?></span><br />
<span class="newsheadlines4"> <b><a href="<?php echo $record['_link'] ?>"><?php echo $record['headline'] ?></a></b></span><br />
<span class="newsheadlines2"><?php echo $record['article_snippet'] ?></a></span></th>
</tr>
</table>
<?php endforeach; ?>
<?php if (!$newsRecords): ?>
<span class="newsheadlines2">No records were found!</span><br/>
<?php endif ?>



BUT NOW IM GETTING THIS ERROR:

Parse error: syntax error, unexpected T_ENDFOREACH in /home/highview/public_html/apexFinal/futsallocation_details.php on line 197


Line 197 is somewhere around here:

<?php endforeach; ?>
<?php if (!$newsRecords): ?>
<span class="newsheadlines2">No records were found!</span><br/>
<?php endif ?>

Re: [s2smedia] Multiple Selection List = where Filter

By Dave - January 27, 2009

Looks like I had a typo there. Try adding the trailing curly bracket:

<?php if (strpos($record['futsal_location'], $winter_academy_locationsRecord['location']) !== false) { continue; } ?>

Let me know if that resolves it.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Multiple Selection List = where Filter

By s2smedia - January 27, 2009 - edited: January 27, 2009

ah ha!!

That does it

the fields were backwords... but i fixed that..

THANKS 1,000,000!!!