Where Statement Issue

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

By efi-revivo - February 21, 2012 - edited: February 21, 2012

I have a problem with my page.
I try to load in Detail page a specific list from other table and matching to a filed (num) in the detail page.

list($test_listingRecords, $test_listingMetaData) = getRecords(array(
'tableName' => 'test_listing',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$test_listingRecord = @$test_listingRecords[0]; // get first record

// show error message if no matching record is found
if (!$test_listingRecord) { dieWith404("Record not found!"); }

list($eventRecords, $eventMetaData) = getRecords(array(
'tableName' => 'event',
'limit' => '6',
'where' => 'num="$test_listingRecord('posts_num')"', <----- This filed control by the first table ($test_listingRecords)
));

Re: [efi-revivo] Where Statement Issue

By Jason - February 21, 2012

Hi,

It looks like you're just having some syntax issues in your where statement.

Try this:

list($eventRecords, $eventMetaData) = getRecords(array(
'tableName' => 'event',
'limit' => '6',
'where' => "num = '".$test_listingRecord['posts_num']."'",
));


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/