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: [Jason] MultiSearch Filtering Functions

By Rusty - February 8, 2011

This is somewhat related... I'm trying to filter content based upon the presence of a users UserNum in an array. The array is created by an admin who makes entries via a multi-select drop down list with CMS.

I know you said you that searchMultipleTables() doesn't support a manual "where" option, but what about the ability to search ONE table? I just need to check each table to see if a userNum is present in that record, and then IF it's true show that record, otherwise continue to the next and try again.
Rusty

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/