I just need to know how to do an if $searchtextterms are between quotes, do a query on the whole phrase. Thanks.$searchtextterms = $in{'searchtextterms'}; $origterms = $searchtextterms; $escterms = $searchtextterms; $escterms =~ s/ /%20/g; $searchtextterms =~ s/\'/\\'/g; $andor = $in{'andor'}; $andor = "AND" if ($andor eq ""); # break searchtextterms on white space to do AND or OR strings @words = split (/ /, $searchtextterms); $num_words = @words; $terms_string = "(title Like '%$words[0]%' OR description Like '%$word +s[0]%' OR organization Like '%$words[0]%' OR type Like '%$words[0]%') +"; for ($n=1; $n<=$num_words-1; $n++) { $terms_string = $terms_string . " $andor (title Like '%$wo +rds[0]%' OR description Like '%$words[0]%' OR organization Like '%$wo +rds[0]%' OR type Like '%$words%')" if ($words[$n] ne ""); } $SQL = "SELECT num FROM database WHERE ($terms_string)";
In reply to Help with search query by htmanning
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |