Gossamer Forum
Home : Products : DBMan : Installation :

searching for either of two words in one field

Quote Reply
searching for either of two words in one field
It looks like maybe this has been danced around a bit in previous posts...

What I would like to do is view a list of records by one field, but by multiple words in that field.

i.e. Field1 can be Yes|No|Maybe
How to display all records with a Field1 that is either 'Yes' or 'Maybe'?

For some reason I'm having a hard time explaining my plight here. Wink

Thanx!
Quote Reply
Re: searching for either of two words in one field In reply to
The simple way to do it is to enter the search term just like you have it:

Yes|Maybe

and click in the "Reg. Expression" checkbox.

The more complicated way to do it is to enter the search term like

Yes or Maybe

and then add the bolded lines below to sub query in db.cgi:

Code:
else { # Otherwise this is a regular search, and we only want records
$i = 0; # that match everything the user specified for.
foreach $column (@db_cols) {
if ($in{$column} =~ / or /) {
$in{$column} =~ s/ or /\|/gi;
$in{'re'} = 1;
}




------------------
JPD





Quote Reply
Re: searching for either of two words in one field In reply to
Ahhhh....interesting. Call it a bad habit, but I opted for the simple way! Smile Works like a charm.

Thanx!