where clause not working

3 posts by 2 authors in: Forums > CMS Builder
Last Post: December 10, 2009   (RSS)

By Deborah - December 9, 2009 - edited: December 9, 2009

I have two separate viewers on the same page displaying information from two categories. I've done this on another site, but for some reason it's not working for me on this site. I can view the records fine if I remove the "where" clause for either one.

The category field uses a multi-value checkbox.

In the head I have:

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
require_once "/var/www/vhost/80/p/www.domain.com/domain/lib/viewer_functions.php";
list($calendarRecords1, $calendarMetaData) = getRecords(array(
'tableName' => 'calendar',
'where' => 'category = "Group A - Meetings"',
));
list($calendarRecords2, $calendarMetaData) = getRecords(array(
'tableName' => 'calendar',
'where' =>'category = "Group A - Events"',
));
?>

In the body:

<?php foreach ($calendarRecords1 as $record): ?>blah, blah, blah...<?php endforeach ?>
<?php if (!$calendarRecords1): ?>Display this if no record.<?php endif ?>

<?php foreach ($calendarRecords2 as $record): ?>blah, blah, blah...<?php endforeach ?>
<?php if (!$calendarRecords1): ?>Display this if no record.<?php endif ?>

Instead of displaying the records for the designated category, I'm seeing the "Display this if no record."

Does anyone see anything wrong here? I am baffled.

Deborah

Re: [Deborah] where clause not working

By Deborah - December 9, 2009

I solved this myself by reading another post.

I replaced this:
'where' => "category = Group A - Meetings",

with this:
'where' => " category LIKE '%\Group A - Meetings\t%' ",

I don't understand why the first method works fine on my other site. Oh, well, problem solved.

Deborah