MultiSearch Filtering Functions

4 posts by 2 authors in: Forums > CMS Builder
Last Post: February 8, 2011   (RSS)

By Rusty - February 1, 2011 - edited: February 8, 2011

I'm trying to filter/limit the results provided by MultiSearch.php . I want to limit it so that it only searches records based upon a where statement.

'where' => 'permission = ' . @$CURRENT_USER['num'],

I've tried ALL kinds of combinations and can't get it sorted.

Closest I've gotten is this, but it doesn't do anything. And the really annoying thing is the MySQL debug shows me that the WHERE statement is there... I can't figure out how to add too it though.

<?php
require_once "/website.com/html/admin/lib/viewer_functions.php";
$searchOptions = array();
$searchOptions['keywords'] = @$FORM['q'];
$searchOptions['perPage'] = "10";
$searchOptions['debugSql'] = "1";
This doesn't do anything, though I wish it did
$searchOptions['where'] = "permission =" . @$CURRENT_USER['num'];

$searchTables = array();
$searchTables['forms'] = array(
'viewerUrl' => 'form-detail.php',
'titleField' => 'title',
'summaryField' => 'description',
'searchFields' => array('title','form_number','description'),

);

$searchTables['order_history'] = array(
'viewerUrl' => 'order_history.php',
'titleField' => 'order_num',
'summaryField' => 'content',
'searchFields' => array('order_num','placed_by'),

);

list($searchRows, $searchDetails) = searchMultipleTables($searchTables, $searchOptions);

?>

Rusty

Re: [Rusty] MultiSearch Filtering Functions

By Jason - February 1, 2011

Hi Rusty,

searchMultipleTables() doesn't support a manual "where" option. It just searches the specified fields from the specified tables against what you entered in the text box.

There are a couple of options to accomplish what you're trying to do. You could filter your results by checking the value of fields as you loop through them. Another option would be to not use MultiSearch and instead to two getRecords calls and create manual where clauses for those.

Hope this helps get you started.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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

Re: [Rusty] MultiSearch Filtering Functions

By Jason - February 8, 2011

Hi Rusty,

If I understand correctly, you're best bet is to only return records where the user's num appears in the multi-select drop down. If this is the case, I think this will do what you're looking for:


http://www.interactivetools.com/forum/gforum.cgi?post=86190#86190


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/