Show records from multi select menu

4 posts by 2 authors in: Forums > CMS Builder
Last Post: October 21, 2008   (RSS)

By Ryan - October 20, 2008

Hi, the following page is almost complete i just need to figure a way of filtering the results from one of the tables.

[url "http://traceybros.vbs4u.com/developments/display.php?Featherbed-Glade-1"]http://traceybros.vbs4u.com/developments/display.php?Featherbed-Glade-1[/#800080][/url]

As you can see the page lists estate agents at the bottom who are selling property in the particular development you are viewing. However the list is displaying all the records in the 'estate_agents' table not just the ones i have selected using a database multi-select list from the 'developments' table.

How can you get these records to filter correctly bearing in mind that each development will have multiple estate agents and each estate agent will be selling properties in multiple developments. I have attached the page and added some comments on the page to show you what im trying to do. Any help would be greatly appreciated.

Thanks
Attachments:

display_002.php 11K

Re: [Dave] Show records from multi select menu

By Ryan - October 21, 2008

Hi Dave, found a post on the forum where you answered this before, spent hours looking yesterday with no joy and it was near the first post i found today.

Thanks,

http://www.interactivetools.com/forum/forum.cgi?post=63527

This is the code i used

// get where
$recordNumbersArray = getListValues('developments', 'agents', $developmentsRecord['agents']);
$recordNumbersAsCSV = join(', ', $recordNumbersArray);
if (!$recordNumbersAsCSV) { $recordNumbersAsCSV = "0"; }

// prevent error from having empty string if no matches
// load all records
list($estate_agentsRecords, $estate_agentsMetaData) = getRecords(array(
'tableName' => 'estate_agents',
'allowSearch' => '0',
'where' => "num IN ($recordNumbersAsCSV)",

));

Re: [ryan_dot] Show records from multi select menu

By Dave - October 21, 2008

Hi Ryan,

Glad you got it sorted out! Let me know if you need anything else. :)
Dave Edis - Senior Developer
interactivetools.com