Multiple Selection List = where Filter

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

I spoke alittle too soon... i have 3 pages I need to add that to... I got 2 of them working...

the 3rd one keeps giving me this error:

Warning: strpos(): Empty delimiter in /home/highview/public_html/apexFinal/summerlocation_details.php on line 171


CODE:

<?php foreach ($newsRecords as $record): ?>
<?php if (strpos($summer_academy_locationsRecord['location'], $record['summer_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'] ?></span></th>
</tr>
</table>
<?php endforeach; ?>
<?php if (!$newsRecords): ?>
<span class="newsheadlines2">No records were found!</span><br/>
<?php endif ?>

By Dave - January 27, 2009

In that case the field probably isn't defined (probably because there is no record). You can force a variable to be a "string" by putting it in double quotes.

Try this:

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

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

By Dave - January 27, 2009

Sorry, try this. Today is a typo kind of day it seems..

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

And you can display an error if there is no record loaded with some code like this at the top:

// error if page not found
if (!@$summer_academy_locationsRecord) {
header("HTTP/1.1 404 Not Found");
print "<h1>404 File Not Found!</h1>";
exit;
}


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

Re: [Dave] Multiple Selection List = where Filter

ok... thats not exactly what i need..

I just realized the strpos code isnt working how i need it either...

I think the best thing would be for me to email you login to my cms so you can see how everything is functioning...

By Dave - January 28, 2009

Sure, I can take a look. I'm at dave@interactivetools.com
Dave Edis - Senior Developer
interactivetools.com