This topic is locked

show filter criteria on results page

9/27/2006 2:54:06 AM
PHPRunner General questions
T
thesofa author

Hi

When I do an advanced search, is it possible to have the search criteria added to the heading on the results page, e.g.

Detentions given for XXBratXX in XXyear groupXX between XX XX XXXX and XX XX XXXX

?

It would be useful for the printouts....

Cheers

Alexey admin 9/27/2006

Hi,
you can print out SQL WHERE clause used for Advanced searching.

Modify this snippet in the ..._list.php file.

See my changes in bold:

else if(@$_SESSION[$strTableName."_search"]==2)

// advanced search

{

$sWhere="";

foreach(@$_SESSION[$strTableName."_asearchfor"] as $f => $sfor)

{

$strSearchFor=trim($sfor);

$strSearchFor2="";

$type=@$_SESSION[$strTableName."_asearchfortype"][$f];

if(array_key_exists($f,@$_SESSION[$strTableName."_asearchfor2"]))

$strSearchFor2=trim(@$_SESSION[$strTableName."_asearchfor2"][$f]);

if($strSearchFor!="" || true)

{

if (!$sWhere)

{

if($_SESSION[$strTableName."_asearchtype"]=="and")

$sWhere="1=1";

else

$sWhere="1=0";

}

$strSearchOption=trim($_SESSION[$strTableName."_asearchopt"][$f]);

if($where=StrWhereAdv($f, $strSearchFor, $strSearchOption, $strSearchFor2,$type))

{

if($_SESSION[$strTableName."_asearchnot"][$f])

$where="not (".$where.")";

if($_SESSION[$strTableName."_asearchtype"]=="and")

$sWhere .= " and ".$where;

else

$sWhere .= " or ".$where;

}

}

}

$strSQL = AddWhere($strSQL,$sWhere);

echo $sWhere;

}


Also you can modify this snippet to print search criteria in more comfortable format.

You need to be familiar with PHP to do that.

T
thesofa author 9/27/2006

thanks Sergey, I shall have to leave that one unless someone else can come and help, I think showing

1=1 and upper(`detentions`.`TutorGroup`) like upper('%8%') and `detentions`.`DateGiven`>='2006-09-18 00:00:00' and `detentions`.`DateGiven`<='2006-09-22 00:00:00' and `detentions`.`DayForDetention`>='2006-09-25 00:00:00' and `detentions`.`DayForDetention`<='2006-09-29 00:00:00' and not (`detentions`.`Done`=1)



will probably have most of the staff off sick with brain damage.

Anyone got any ideas for this one?????