Another "where" question.

3 posts by 2 authors in: Forums > CMS Builder
Last Post: June 19, 2012   (RSS)

By Toledoh - June 19, 2012



Hi Guys,

How do I achieve this? I want to show all items that are associated to the current applicationsRecord. Currently, it's "equals" not "LIKE" ... know what I mean?

<?php

// load record from 'applications'
list($applicationsRecords, $applicationsMetaData) = getRecords(array(
'tableName' => 'applications',
'where' => whereRecordNumberInUrl(0),
'loadUploads' => true,
'allowSearch' => false,
'limit' => '1',
));
$applicationsRecord = @$applicationsRecords[0]; // get first record

// load records from 'items'
list($itemsRecords, $itemsMetaData) = getRecords(array(
'tableName' => 'items',
'where' => "application_group =".intval($applicationsRecord['num']),
'loadUploads' => true,
'allowSearch' => false,
));

?>

Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] Another "where" question.

By Chris - June 19, 2012

Hi Tim,

Is the problem that items.application_group is a Multi-Value List field? If so, you'll want to do this:

'where' => "application_group LIKE '%\t".intval($applicationsRecord['num'])."\t%'",

Does that help?
All the best,
Chris