This topic is locked

% in search fileds

5/16/2007 5:31:07 PM
PHPRunner General questions
C
cgilpin author

Hi,

I am still using the demo version oh phprunner 4.0 build 252 until I get my ordering sorted out. I have a problem with search and %. I assume that the % is a wild card? I need to be able to include % in a search term - e.g. searching for a substance where the field contains say 4% oil. Any suggestions?
THanks for the great software
Chris

J
Jane 5/17/2007

Chris,
no PHPRunner doesn't use % as wild card.

You can use 4% as search parameter on the List or Advanced search list.

C
cgilpin author 5/19/2007

Chris,

no PHPRunner doesn't use % as wild card.

You can use 4% as search parameter on the List or Advanced search list.



If I use 4% as a search term a record which has an "ID" field of 4 is displayed as well as records which have 4% somewhere in any field. I do not display the field "ID" and I do not want the search to match the 4 in the "ID" field.
Chris

J
Jane 5/21/2007

Chris,
I see what you're saying.

You can do the following:

  1. open ..._searchsuggest.php file, find this line:
    $searchFor = postvalue('searchFor');

and add following code just after:

$searchFor = str_replace('%','\%',$searchFor);


2. open include/commonfunctions.php file, locate StrWhere function, find this code:

$ret="";

if($strSearchOption=="Contains")

and replace it with this one:

$ret="";

$sSearchFor = str_replace('%','\%',$sSearchFor);

if($strSearchOption=="Contains")