Call list(...) multiple times in same page...

2 posts by 2 authors in: Forums > CMS Builder
Last Post: September 29, 2011   (RSS)

Hello-

I'm trying to return a relevant set of records from CMSB based on what the user specifies...For example if they click on "Under 1,000,000", I execute this, which resides in a javascript function called "pricegroup1":

<?php
// load records
list($properties_for_saleRecords, $properties_for_saleMetaData) = getRecords(array(
'tableName' => 'properties_for_sale',
'where' => 'list_price<1000000',
'orderBy' => 'list_price DESC',
));
?>

If they click on "1,000,000 to 1,499,999", I WANT to execute this, which resides in another javascript function called "pricegroup2":

list($properties_for_saleRecords, $properties_for_saleMetaData) = getRecords(array(
'tableName' => 'properties_for_sale',
'where' => 'list_price>=1000000 and list_price<1500000',
'orderBy' => 'list_price DESC',
));

It's only when I add the 2nd list() block to my PHP page that things stop working, and my browser says there's a javascript error...no ending semicolon on a line number that doesn't even exist...

If I remove the where clause from the 2nd list() bloc, the js error goes away, but of course, the correct data isn't returned. Also, if I simplify the where clause to 'where' => 'list_price<1500000', the error returns...If I change this to 1000000, the error goes away again...

My question is: Is it legal to have more than 1 list() block on a page....I'm stuck...

I hope this is somewhat clear...

Thanks for the help...Rick