I am attempting to make a simple search engine on a web site.
it has 3
parameters. Service, State, and Keywords. I pass the 3
criteria's to a
results page that invokes a component. If you just choose the
service and
state it works fine, but if you enter a keyword it fails.
In my database I have a dummy company set to a service and a
state and uses:
"Quote, design, print, web, posters, signs" in a keyword
column.
When I enter the correct service and state it comes up just
fine, but if I
enter the word "web" into the keywords it doesn't find the
same listing.
Here is my component:
<cfcomponent>
<cffunction name="ServiceSearch" access="remote"
returntype="query">
<cfargument name="service" type="string"
required="true">
<cfargument name="state" type="string"
required="true">
<cfargument name="keywords" type="string"
required="false">
<cfquery name="ServiceResults"
datasource="#Request.MainDSN#">
Select company, name, phone, service, city, state, username
FROM members
WHERE service = #arguments.service# AND state =
'#arguments.state#'
<cfif len(trim(form.keywords)) GT 0>
AND keywords LIKE '#arguments.keywords#'
</cfif>
ORDER BY company ASC
</cfquery>
<cfreturn ServiceResults>
</cffunction>
</cfcomponent>
Can anyone tell me why? I have tried keywords LIKE
#argument.keywords# and
keywords = #argument.keywords#
Thanks
--
Wally Kolcz
Developer / Support